MacPorts – Compile and install open-source software on Mac OS X

macportsThe MacPorts Project provides software installation, updating, and removal functionality to OS X similar to Linux’ apt-get or yum. The Project is currently tracking more than 5000 packages including software such as subversion, wget, apache2, php5, etc.

To install the software, first install Apple’s Xcode Developer Tools (available on your Mac OS X installation disc) and the X11 windowing environment (included by default in 10.5.* “Leopard”, but available on your Mac OS X installation discs for 10.4.* “Tiger” and 10.3.* “Panther”), then download the MacPorts DMG (disk image), mount the disk image and run the installation package.

After the installation has completed, reopen any Terminal windows to reload PATH settings updated by the installation, then run the following command to update the MacPorts software:

sudo port -v selfupdate

Detailed usage instructions can be found in the MacPorts Guide, but the basic commands are:

Install a package:

sudo port install {PACKAGENAME}

Uninstall a package:

sudo port uninstall {PACKAGENAME}

Delete intermediate files created while a port was built:

sudo port clean

List all installed packages:

sudo port installed

List all packages available:

sudo port list

Search all packages available:

sudo port search {SEARCHTERM}

 

Related posts:

  1. TrueCrypt – Free open source encryption software
  2. Uninstall Google Software Update on Mac OS X
  3. A Python script to check Google rankings for a specific domain and search term
  4. Finding lost ZIP passwords with fcrackzip
  5. Editing, Validating and Querying XML with the XMLStarlet command line utility
Twitter Digg Delicious Stumbleupon Technorati Facebook Email

5 Responses to “MacPorts – Compile and install open-source software on Mac OS X”

  1. Great post but if you aren’t into using a package manager, feel free to download a fully-complete installer package for Subversion here: http://www.open.collab.net/downloads/community/. (Hopefully this isn’t seen as post hijacking. Just wanting to help as many as possible.)

  2. Thanks, Jeremy! Package managers can be daunting to non-technical users, in which case automated installers on an app-by-app basis are a good way to go. :)

  3. If you get “Command not found” when trying to run port, make sure that /opt/local/bin is in your PATH.

    E.g. you could add the following line to your .bash_profile
    export PATH=$PATH:/opt/local/bin

  4. Thanks, Paul!

    sudo nano ~/.profile

    …will let you edit the setting, make sure that “/opt/local/bin” is included in the export line for PATH. In my case:

    export PATH=/opt/local/bin:/opt/local/sbin:$PATH
    export SVN_EDITOR=/usr/bin/nano
    export EDITOR=/usr/bin/nano

    (Only the “export PATH” line is relevant to the article, the others are just included for context.)

Trackbacks/Pingbacks

  1. Finding lost ZIP passwords with fcrackzip | Geekology - 17 Jul 2009

    [...] install fcrackzip on Mac OS X, first install MacPorts then install fcrackzip through MacPorts: sudo port install [...]

Afrigator