Recently, I ran into an issue trying to get npm to install a new Node.js application that was similar to something that I’ve experienced before with Homebrew. Turns out trying to get Homebrew working correctly on OSX Mountain Lion is a bit of a pain. Both of these package managers rely on having Xcode installed and accessible at the command line.
Normally, you should be able to install Xcode and install the Developer Tools package, or just install the standalone Xcode Command Line Tools to allow command line applications to compile applications using Xcode. However, sometimes you’ll find that Xcode is no longer accessible from the command line.
This is the error I saw using npm:
1 2 3
You might get an error like this during a Homebrew installation or if you’ve used
1 2 3 4 5 6 7 8 9 10
The solution depends on what you’ve got installed.
Firstly, check that you have the latest version of Xcode (or the latest version of the Xcode Command Line Tools).
If you have the Xcode Command Line Tools installed, you can try setting the Xcode path using the
This points xcode-select to the /usr/bin/xcodebuild location of the Command Line Tools, but can lead to Homebrew hanging (it explicitly warns against this).
A better solution is to install Xcode (which is a bit silly to install a huge application to run some command line tools, but there you go).
If you have the full installation of Xcode installed, you can set the Xcode path using a more complete
If you’re wondering what caused all this kerfuffle, it was the changes in Xcode 4.3 that removed the Command Line tools and the /Developer directory that caused some of these things to go haywire.