OS X Lion and MacPorts: how I made it work

Recently I received my new MacBook Air 13″ (sadly my old MacBook Aluminium is almost dead) and among all the problems I have with Lion probably the one I have with MacPorts is the most frustrating!

Someone can object with “why don’t you use Homebrew? It’s much better than Port because BLAH BLAH BLAH BLAH BLAH”, but I don’t care: I want Port working, not something else!

So after some searches around I found something that “magically” fixed everything.

The problem seems to be related to a missing setting after the installation of the Xcode. In particular the installation of the Xcode from the App Store (besides not installing by default the “Command line tools”) doesn’t set the “xcode_folder_path”.

To check if everything works it’s enough to run:

/usr/bin/xcodebuild -version

This gave me back:

xcode-select: Error: No Xcode folder is set. Run xcode-select -switch <xcode_folder_path> to set the path to the Xcode folder.
Error: /usr/bin/xcode-select returned unexpected error.

Well, now the solution is clear! It’s enough to set the xcode_folder_path!

So I run:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer



is the path of the Xcode application installed through the App Store.

Now if you run again:

/usr/bin/xcodebuild -version

you will have

/usr/bin/xcodebuild -version
Xcode 4.3.2
Build version 4E2002

All the Ports now should work! Well…. for me now they work!

Leave a Reply

Your email address will not be published. Required fields are marked *