Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

location of C header files

In composing this post to ask a question, I learned the surprising answer. Thought it worth sharing.


Question: I'm an experienced C programmer in Unix environments, not so much in OS X. Most of my C programs build fine on my Mac, using the gcc and make that came with Xcode. What I don't understand is why I don't have a /usr/include directory. Where has Apple put the standard C header files?


Answer: In preparing this post, I decided (FWIW) to provide the version of gcc that I'm using:


$ gcc --version

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/Mac OSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)

Target: x86_64-apple-darwin13.4.0

Thread model: posix

$


And there was my answer!:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/S DKs/MacOSX10.9.sdk/usr/include

MacBook Pro (17-inch Early 2011), OS X Mavericks (10.9.5)

Posted on Jul 11, 2015 1:21 PM

Reply
6 replies

Jul 11, 2015 1:30 PM in response to Ken Nellis

Hello Ken,

If you are a die-hard UNIX programmer and never intend to write any software other than for your specific Mac, then you can install the command line tools and that will give you the /usr/include that you expect. You can find the command line tools the "other downloads" section of the developer centre. You may also be able to automatically download and install them by attempting to run something like git. I think you can also trigger the download by running "xcode-select --install". However, depending on the version(s) of Xcode you have and your system, the automatic command-line installer may not work properly. I recommend making sure to get just the one you know you need from the developer centre.


Generally, the Mac's main purpose for a developer these days is as a cross-compiler for iPhone apps. For most developers, the last thing they would ever want is to pick up some header from /usr/include when they are targeting a different platform. So not having this directory makes life easier for most Mac developers.

Jul 11, 2015 4:57 PM in response to VikingOSX

Thanx for the responses, guys. Get Info says my Xcode.app is version 5.1.1, so obviously old. Thinking I need to launch it to install the command-line tools, when I launch it, which I never do—I just use gcc and make—it launches the App Store, which gives me the message, "This item is temporarily unavailable. Try again later." After several tries over several hours, I'm beginning to doubt how "temporary" the unavailability actually is. Advice?

Jul 11, 2015 5:55 PM in response to Ken Nellis

With Apple, you stay up-to-date or go home. I don't know which version of Xcode you should run for Mavericks. Apple used to say which version was for which operating system but they seem to have stopped doing that as of Xcode 6.2.


As VikingOSX mentioned, they have really jacked around the developer site. I was unable to find a link to the download page from the developer site itself. From Xcode 7 > Xcode > Open Developer Tool > More Developer Tools... I have discovered that the URL is https://developer.apple.com/downloads/


There, you will see all of the command-line tools. There is even a download specifically for Xcode 5.1.1 on Mavericks: Command Line Tools for OS X Mavericks - April 2014.dmg


Apple specifically says that Xcode 6.1.1 will run on Mavericks. No guarantees about anything else. You should be aware that Apple hasn't included GCC for some time. The GCC you think you are running is Clang pretending. Depending on your situation, that may be fine, bad, or useless. I don't know. Xcode gets significant changes each release so I really don't remember how command-line tools worked in Mavericks and Xcode 5.1.1. If I recall correctly, that was the last build that still supported Mountain Lion, the most stable of all recent OS versions. I think that was a pretty good version. I suggest you stick with that unless you have an urgent need to update.

Jul 11, 2015 8:11 PM in response to Ken Nellis

The last Xcode supported on Mavericks is 6.2. The last command line developer tools for Xcode (OS X 10.9) is 6.2 from March 10, 2015. This is the end of the road for Mavericks Xcode support. As etresoft mentioned, stay current or go home. It is Apple's game. Staying current means upgrading your operating system every year just to keep up with the latest Xcode release.

location of C header files

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.