I just upgraded to Mojave from High Sierra and installed Xcode plus its command line tools and additional tools. Nothing will compile from the terminal, everything says /usr/include is missing!

I checked and ALL the Dev related dirs under /usr are missing!

Any idea how to fix?

up vote 5 down vote accepted

You have to run another step after installing the command line tools:

installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

Why? No idea, usual Apple new OS build tool dance.

  • 2
    Nicholas Smith: How did you find this out? – Bryan Dunphy Sep 28 at 17:27
  • 1
    I don't even have a Packages directory?! – nohillside Sep 28 at 17:54
  • I saw it on StackOverflow at some point and it stuck in my head. – Nicholas Smith Sep 28 at 21:08
  • You probably need the command-line tools before attempting this. See this answer. – ephsmith Sep 29 at 11:43
  • You might need to use sudo to get this command to work – stackErr Oct 31 at 23:46

The "why" is because Apple has deprecated having a /usr/include distinct from the SDK. You shouldn't rely on having it going forward.

The compilers know already to find their includes inside the SDK, so there's no real need for the /usr/include directory any more. You can find the SDK's install directory for the include files using xcrun --show-sdk-path

  • 4
    Is this documented anywhere? – Mark Sep 30 at 18:57
  • Except the fact that macOS is (was) unix04 certified. – lanza yesterday

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.