How to upgrade MacPorts to OS X 10.8 Mountain Lion

This weekend I upgraded OS X from Lion to Mountain Lion. Documenting steps I had to do to get all my development environments working with MacPorts.


  • First installed the latest XCode via the Mac App Store
  • Downloaded/Installed Mountain Lion
  • Launched XCode one to so I could agree to license, etc.
  • MacPorts also requires the XCode Command Line tools which are a separate install. Inside XCode preferences: “Instead, they can be installed optionally using the Components tab of the Downloads preferences panel as shown in” (source)
  • Had to run “sudo xcodebuild -license” after getting “Error: for port libunwind-headers returned: command execution failed”. Run this, scroll down, type agree.
  • sudo port selfupdate
  • sudo port upgrade outdated
  • Everything finished and worked properly except MongoDB. Currently there’s a bug and the easiest/best work around seems to be just manually installing the latest stable OS X version from and manually copying the binaries into /opt/local

Follow @philfreo on Twitter

Want to know when I write another post? (very infrequent)


  1. Kenneth John Balgos said,

    August 2, 2012 @ 12:43 am

    This solves my problem installing apple-gcc4.2. Thanks!

  2. Clemens said,

    August 27, 2012 @ 10:26 am

    You shouldn’t overwrite stuff in /opt/local with files not installed by MacPorts. First, this might not work correctly due to linking on OS X using absolute paths and second, MacPorts might fail to uninstall this correctly, leaving you with a cluttered or broken system.

    Put the mongodb download somewhere else and prepend it’s path to your $PATH variable, or downgrade to boost 1.49 ( has more on that), which will allow you to install mongodb from MacPorts.

  3. Phil Freo said,

    September 19, 2012 @ 2:21 pm

    @Clemens — good point. For upgrades I’m now putting the mongo binaries in /usr/bin/ instead.

  4. Phil said,

    November 2, 2012 @ 11:41 pm

    Update: ‘sudo port install mongodb’ works now!

RSS feed for comments on this post