Installing MacPorts


This document describes the process for installing MacPorts, based on the MacPorts Installation Guide.  There are also more instruction in the MacPorts Documentation.  All options and alternatives are not described here, just one relatively simple way of installing MacPorts.

Installing X11

Apple's X11 is installed as standard on Leopard (10.5) and Snow Leopard (10.6).  On Tiger (10.4) it is an optional install.  It can be installed from the original installation DVDs.

Both the X11 and X11SDK are needed.  The X11SDK is part of the Xcode Tools package (see the Xcode Tools section below).  You can check whether these are installed by looking for and in /Library/Receipts/boms/.  On Mac OS X 10.4, the files are named X11User.pkg and X11SDK.pkg in /Library/Receipts/.

The following command should list these packages, if found:

Note: Only tested on Tiger.

    $ find -E /Library/Receipts -regex '.*(com\.apple\.pkg\.X11(User|SDKLeo)\.bom|X11(User|SDK)\.pkg)'

Xcode Tools

Whilst the Xcode Tools package is included on the installation DVDs, it is recommended to download the latest version from the Apple Developer's Connection website.  You have to register to download the tools.  The free membership package suffices our needs.  Note: The Xcode Tools package is a significant download size.  The download sizes are shown against each download link.

Install the Xcode Tools and X11 SDK packages as follows:

  1. Login to the Apple Developer Connection

  2. Follow the link to the "Downloads" section

  3. Select "Developer Tools" from the "Downloads" side bar

  4. Search the Developer Tools page for the latest version of Xcode for your version of Mac OS X

    At the time of writing, the versions are:

    Mac OS X Xcode Tools Version --------------- ------------------- 10.4 Tiger 2.5 10.5 Leopard 3.1.4 10.6 Snow Leopard 3.2.1

  5. Run the Xcode Tools package installer

  6. Select the "Customize" option and open the "Applications" category and ensure that the "X11 SDK" option is selected

  7. Make sure the command line development option is also selected

  8. Select the "Install" option


To install the binary version of MacPorts:

  1. Download the latest MacPorts-1.x.x.dmg disk image from the MacPorts download directory.  Don't choose those containing -rc or -beta in their file name.

  2. Run the installer choosing the "easy" installation option

That's it.  MacPorts is now installed.

Managing Ports


Run sudo port selfupdate periodically to update the local ports tree with the global MacPorts repository.

Then run sudo port upgrade outdated to upgrade any outdated installed ports.


Ports needing update:

$ sudo port selfupdate
$ port outdated

Installed ports:

$ port -qv installed

Ports specifically requested for installation:

$ port -qv installed requested

For a unique list, with duplicates removed:

$ port -qv installed requested | cut -d ' ' -f 4 | sort | uniq

Show list of installed files for a port

$ port -q contents <portname>

Ports that have older versions that could be removed

$ port installed inactive


$ sudo port uninstall <portname>

Consider also using the --follow-dependencies to also remove automatically installed dependencies that are not longer being used.

Uninstall a specific version:

$ sudo port uninstall ghc @7.8.3_4

Uninstall all inactive ports (ports with newer versions installed):

$ sudo port uninstall inactive


Remove build files for failed build:

$ sudo port cleanup gpsbabel

Remove unused automatically installed dependencies:

$ port echo leaves
$ sudo port unininstall --follow-dependencies leaves

Mark as not Requested

$ sudo port unsetrequested <portname>

Installing Older Port Versions

Essentially, sudo port activate ${PACKAGE} @${VERSION}

sudo port activate <portname> will list available versions and prompt for a choice.

Deactivate a port

$ sudo port deactivate <portname>


Applications are built under /opt/local/var/macports/build/



Usage Statistics



qlandkartegt port fails to build gpsbabel

Either download and install the Mac OS X version of GPSBabel from or install the gpsbabel port first.

On macOS 10.12 Sierra, gpsbabel can be built as follows:

$ sudo port install gpsbabel +qt4

-- Frank Dean - 31 Mar 2017


-- Frank Dean - 07 Feb 2010

Related Topics: AppleMaciBook, InstallingKitlistMacOSX, MacKeyboardTips