Categories:
macOS C library SDKROOT location (macOS Homebrew LLVM/clang)
比如 MacOSX 13.1 SDK 的位置在 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk
可以在 ~/.zshrc
输出 SDKROOT
的值。
export SDKROOT='/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk'
但如果遇到系统的大更新就没了,所以更好的位置是
export SDKROOT='/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
export PATH="/usr/local/opt/llvm/bin:$PATH"
export LIBRARY_PATH="$LIBRARY_PATH:$SDKROOT/usr/lib"
这样加完以后就能用 Homebrew 的 LLVM 了。
❯ clang --version
Homebrew clang version 14.0.6
Target: x86_64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin