Reputation: 1229
I have installed Xcode 5 on OS X Mavericks. I have a problem with the command-line tools (cc et al).
The version of cc in /usr/bin
is outdated, so I’m not using it. The version of cc embedded deep within Xcode’s application bundle is current, so I’ve pasted the following code into my shell profile:
export PATH=`xcode-select -print-path`/usr/bin:`xcode-select -print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin:${PATH}
This worked under Xcode 4 on Mountain Lion. Now, however, while the compiler seems to run fine when invoked as cc
, it won’t compile anything when I invoke it that way; it apparently cannot find system headers (e.g. stdio.h
). When I invoke the compiler as xcrun cc
, everything works just fine. Unfortunately, this requires me to patch the inputs for each and every build-automation program (such as make
) before they will run properly.
The other problem is that I cannot find the command-line tools for download from ADC. As I upgraded from Mountain Lion, invoking /usr/bin/cc
does not ask me if I want to download the tools; it just runs the (outdated) copy of cc
from Xcode 4.
What is the difference between cc
and xcrun cc
, and is there anything I can do that will cause cc
to work properly from the Terminal (or automated build tools)?
Upvotes: 1
Views: 1820
Reputation: 29635
I have no problems with cc (although you will get better results if you use clang
instead of cc
. I suggest that you remove the program, download it again, and install the command line tools with xcode-select --install
Upvotes: 0
Reputation: 85025
On OS X 10.9 Mavericks, run xcode-select --install
to update the installed command line tools so they match the version inside of Xcode. This also installs header files into /usr/include
and /System/Library
and installs additional development libraries. This is a change from previous versions of OS X where the command line tools were either installed via Xcode.app itself or by an Xcode installer. It is still possible to download a standalone installer from the Apple Developer site but should normally no longer be necessary on 10.9.
Upvotes: 1