How To: Install MacPorts on OS X Leopard (10.5)

Purpose: install MacPorts on OS X Leopard (10.5) to gain access to a host of open source applications and tools that make working on the Mac as cool as can be. Using MacPorts makes it easy to install applications you would otherwise have to build from source — which can be difficult for folks like me, who don’t understand what the hell they are doing in the first place.

Install MacPorts

First, we’ll need to make sure you have “XCode Tools” installed on your Mac — XCode Tools install all the programs needed to build applications from source. It comes standard with all Macs, however, it isn’t installed by default, so you’ll need your installation DVD (or you can download them). From the DVD, go to the “Optional Install” folder and then “XCode Tools” and run the installer package.

Second, we’ll have to download and install the MacPorts from: http://macports.org/install.php. Choose a .dmg disk image for whichever version of OS X you are using.

Third, after MacPorts has been installed, we’ll need to update our PATH variable in the Terminal to be able to find the MacPorts program (which is called port). If you have your own way of doing this, go for it — however, I created a ~/.bash_profile file to accomplish this task. If you don’t already have a profile file, you can do this by entering the following in the terminal (I also added two other common places programs get installed on the command line that save me trouble down the road):

  • $ echo "export PATH=/usr/local/bin/:/usr/local/sbin/:/opt/local/bin/:/opt/local/sbin/:$PATH" >> ~/.bash_profile

Restart the Terminal program for these changes to take effect. If this has been accomplished successfully, then you should be able to run (again in the Terminal) the following for a self-update and it should work:

  • $ sudo port -v selfupdate

If nothing happens and, instead, you get an error that says: -bash: port: command not found, that means your PATH variable wasn’t set correctly. If this is the first time you are running a command using sudo you’ll get a warning saying something to the effect of: if you don’t know what you are doing, turn back now. Ignore this warning.

What’s Next

With MacPorts installed by itself, nothing much is going to change. But you’ll be able to use it to install open source applications that are very exciting (like lame, flac, ffmpeg, gimp, etc).

4 Comments (newest first)

  1. Tracker Now LLC

    How To: Install MacPorts on OS X Leopard (10.5) « damontimm.com

  2. Irfan Lateef says:

    Thanks man it worked for me (Y)

    Cheers

  3. John says:

    What worked for me when I got the “Command not found” on my OS X 10.5.x machine when doing

    sudo port -v selfupdate

    Was to quit out of Terminal, re-run the Macports installer.

    Then the command sudo port -v selfupdate worked.

  4. Ben says:

    Thanks, that helped. I’ve been trying to install MacPorts for 2 hours.