After upgrading to Mountain Lion, I noticed that I can't install ports via Macports. I get the following error:

Error: The installed version of Xcode (3.2.6) is too old to use on the installed OS version. Version 4.1 or later is recommended on Mac OS X 10.8.

I have Xcode version 4.4.1 + command line tools, I tried upgrading ports, and selfupdate, but I still get the same error.

2 Answers 2


Downloading a new version of MacPorts will be required as noted in Migration - MacPorts since you updated to a new version of OS X and additionally too a new version of Xcode. The old MacPorts install is now longer compatible with the installed OS and development tools.

Migrating a MacPorts install to a new major OS version or CPU architecture

An installation of MacPorts and the ports installed by it are only designed to work on a single OS release and a single CPU architecture. If you upgrade to a new OS version (e.g. from Leopard to Snow Leopard) or migrate to a new machine with a different type of CPU (e.g. PowerPC to Intel), you may get lucky and have your ports keep working, but in general, things will break. If you are only upgrading Xcode (e.g. 4.1 to 4.2 on Lion) but not the major OS version or CPU architecture, you do not need to reinstall ports as described below.

Reinstall Xcode and MacPorts

After performing either of these types of system upgrades, you will first need to install the base MacPorts system again, either from the appropriate disk image or from source. If you are upgrading from a prior version of Mac OS X, install the latest version of Xcode for your new OS. This will not be done for you automatically; Xcode is not updated by Software Update, so you must update it manually. For Lion, Xcode is available for free on the Mac App Store (after install you may also need to install "Command Line Tools": XCode->Preferences->Downloads; if upgrading from previous version of xcode you may also need to do 'sudo xcode-select -switch /Applications/Xcode.app', see this SO article). For earlier OS versions, you will find the Xcode installer on the Mac OS X installation DVD or on the Apple Developer web site.

See Installing MacPorts for more information on how to get and install the latest version of MacPorts.


I don't use Macports, but sounds like you maybe have some old bits of Xcode lying around—a /Developer folder, for example? What does running /usr/bin/xcode-select --print-path in a terminal tell you? If the output isn't /Applications/Xcode.app/Contents/Developer (i.e. Xcode 4.x), you can use xcode-select --switch to make it so. That might help, but if that's the problem you'll probably want to try and completely clean up your old Xcode installation sooner or later.

  • the output gives gives me /Applications/Xcode.app
    – gavflynn
    Aug 15, 2012 at 15:36
  • how do I completely remove Xcode and re-install?
    – gavflynn
    Aug 15, 2012 at 15:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .