Friday, April 27, 2012

Resolving multiple versions of Xcode command line tools

By:
Lately I had a spare machine that I wanted to install MacPorts ports such as "coreutils" onto.  However, since it had both an older version of the Xcode command line tools associated with Xcode that was installed before things moved to the App Store as well as the latest version (4.3.2), I ran into an issue where MacPorts didn't like the current version of the command line tools that were being linked.

If you open terminal, you can verify which version of the Xcode command line tools you currently have:
xcodebuild –version

And the path that is being used:
xcode-select –print-path

If the first command shows something like “4.0.x” and the second shows something like “/Developer”, you’ll want to first install the latest Xcode command line tools (either from Xcode preferences or from https://developer.apple.com/downloads/index.action#).  Then you’ll need to “switch” the path to the latest version that is associated with Xcode as downloaded from the App Store:
sudo xcode-select –switch /Applications/Xcode.app/Contents/Developer

Running the following should now show “Xcode 4.3.2”:
xcodebuild –version

Now you can proceed to install ports from the command line:
sudo port install coreutils

0 comments: