Missing /usr/include in OS X El Capitan

I was trying to build an app which depends on PJSIP lib which should have some headers in /usr/include. But there is no /usr/include folder, and I can't create one even my account has administrator rights.

How can be include folder, activated/created/restored ?


Solution 1:

Update (12 Feb 2016):

I finally installed El Capitan and can now confirm that Ondřej Čertík's answer is correct. I strongly recommend installing the command line developer tools instead of disabling SIP.

As Ondřej noted, simply installing Xcode will not install all of the command line developer tools. You must execute xcode-select --install in Terminal.


Original post (5 Dec 2015):

Write access to /System, /bin, /sbin, /usr, /etc, /tmp and /var has been disabled by default in El Capitan, even for root. This is due to the new Security Integrity Protection feature.

To disable SIP, boot into recovery mode and execute the command csrutil disable in Terminal.

Disclaimer: I have not tested this myself since I have not yet upgraded to El Capitan.

Solution 2:

By default, when you install Xcode ("developer tools") from the App Store on El Capitan, it does not install the "command line developer tools" which include the /usr/include. To install the "command line developer tools", execute xcode-select --install, it will prompt you about whether you want to get Xcode+command line tools from the App Store (but I already have Xcode installed from the App Store and it apparently does not include the command line utilities), so I selected "install" and that installed /usr/include among other things.

As to the System Integrity Protection (SIP), leave that enabled, as that seems to be a good thing. The reason xcode-select --install managed to install into the protected /usr directory is probably because xcode-select is whitelisted by SIP.