1

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)?

2 Answers 2

1

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.

0

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

2
  • Doesn't it have a different behavior if you invoke it as cc than if you invoke it as clang?
    – vy32
    Nov 3, 2013 at 23:25
  • With Xcode 5, not that I know of. But others may know more about it.
    – Ned Deily
    Nov 3, 2013 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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