Can't build clang and libc on macOS?

On macOS, you need to specify -isysroot to tell clang where to look for the system headers. You can get the sys root path for macOS (e.g. xcode - How to get the path of latest SDK available on Mac - Stack Overflow)

You should be able to use clang without needing to build libc by doing something like:

clang -isysroot `xcrun -sdk macosx --show-sdk-path` main.c
2 Likes