AppleClang adds `/usr/local/include` to application search folders

By default, AppleClang adds /usr/local/include to the application search folders for include files (as opposed to the system include dirs). This causes problems with the expected include order because application search folders always have priority over system includes. Specifically it causes problems with the conan package manager as library includes are added with -isystem

This behaviour differs from LLVM mainline clang and GCC, where /usr/local/include is a system include (added with -internal-isystem).

Steps to reproduce -

  1. run
echo 'int main() { return 0; }' | clang -xc -v -
  1. the output is as follows
Apple clang version 17.0.0 (clang-1700.0.13.5)

Target: arm64-apple-darwin24.5.0

Thread model: posix

InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" ... -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk 
-I/usr/local/include 
-internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include ...
Answered by DTS Engineer in 853499022

You’ve structured your post like a bug report. If your goal is to get Apple to change this behaviour, the best way to do that is to file a bug in Feedback Assistant. And if you do that, please post your bug number, just for the record.

But if I’m off the mark here, I’d appreciate your clarifying your goals here.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

You’ve structured your post like a bug report. If your goal is to get Apple to change this behaviour, the best way to do that is to file a bug in Feedback Assistant. And if you do that, please post your bug number, just for the record.

But if I’m off the mark here, I’d appreciate your clarifying your goals here.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

AppleClang adds `/usr/local/include` to application search folders
 
 
Q