Making MacPorts work again after upgrading to Mavericks

Making MacPorts work again after upgrading to Mavericks

Although pretty much everything “just works” after upgrading from Lion/Mountain Lion to Mavericks, one thing that doesn’t is MacPorts. Well, it still works, or at least it did for me, but you’re unable to upgrade it or install more ports, as they all fail with various error messages (including “Error: org.macports.extract for port gperf returned: command execution failed”), and the usual

sudo port selfupdate

just gives the message

MacPorts base version 2.2.1 downloaded.
—> Updating the ports tree
—> MacPorts base is outdated, installing new version 2.2.1
Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl

Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed

Fixing this involves several steps. Firstly, go away and download the latest installer for MacPorts. At the time of writing, it’s here, but if it’s moved there should be a link on this page. Install that, and come back.

Back? Hello again!

Next, you’re going to need to make sure you have the latest version of Xcode installed. You may have done this as part of the “install ALL the updates” routine after installing Mavericks, but if not, check the App Store updates tab and install the latest version. At the time of writing it’s v5.0.1 so you’ll need at least that.

In addition to Xcode, you also need to install the Xcode command line tools. You can do this in the terminal, with the command:

sudo xcode-select --install

Once installed, open Xcode and accept the licence agreement.

Now ports should be able to compile, so you’ll need to do the following (again, in a terminal):

sudo port selfupdate
sudo port upgrade outdated

and then wait while it does its thing. Depending on how many ports you have, this may take some time. As well as other things, I had Imagemagick and the ten billion depends associated with it, so it took well over an hour. Once it’s finished, MacPorts and all the ports for it should be updated and ready to go.

0 Comments

  1. Pingback: New laptop | Blogs for Industry

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.