One of the reasons I really like Mac OS X is it’s native Unix origin. In fact, Mac OS X is Unix. This translates into having easy access to common Unix tools and applications. I won’t say many users take advantage of this, I’m even willing to bet most don’t, but those who do feel life is a lot easier I’m sure. Tools as simple as wget or lftp make mine a lot easier.

Most of these tools can be installed in any regular Unix/Linux flavor but they have to be ported into the flavor before they can be used. This means some lines of code have to be changed in order for our Unix flavor to understand it.

Meet Macports.

Installing Macports

Macports makes it easy to download and install Unix applications, be it simple command line tools or full fledged graphical applications. The easiest way to get it is download the .dmg for your version of Mac OS here and install it on your applications folder. You will also need XCode installed in your Mac. XCode is a set of developer tools for Mac allowing you to compile and install applications from source. You can find it in your Mac OS X install CD under the “Optional Installs” folder. From this moment on you will have access to the ‘port’ command on your Terminal app.

Installing Applications

Installing ported applications is very easy. All you have to do is issue the following command inside a Terminal app.

sudo port -v install wget

What this will do is download the ported version of wget and all it’s necessary dependencies, compile them and install them on your system. The -v switch tells it to run on verbose mode, displaying all he’s doing at the moment. You can turn it off if you don’t need or like it. A list of all the software you can install this way can be found here. Since it needs superuser access it will ask for your password.

Uninstalling applications is also simple.

sudo port -v uninstall wget

One of the options I found really useful is the ability to create a .dmg that installs everything you need to install the chosen package in any given system. Running the following command for example will create a .dmg file with wget and all it’s dependencies ready to install in any mac even without Macports installed.

sudo port -v dmg wget

Keeping up to date

It is also very easy to keep all your installed applications up to date with the latest software’s version. Issue the following commands on your Terminal app.

sudo port -v sync

sudo port -v selfupdate

sudo port -v upgrade outdated

What the first command will do is syncronize with the Macport’s server and figure out what’s the newest version number for all available software. The second command will update Macports itself it need be. The third and final command will upgrade all your outdated software to it’s current versions.

Keeping it clean

I’m one of those guys that likes to keep it’s system clean of near useless stuff, disc space is something I’ll never have enough of. This said, Macports likes to keep old versions of software installed after you update them to the newest version as well as intermediate files that are needed to compile and install software. This adds up bit by bit till it takes up large chunks of precious disc space. Running the following commands will get rid of all that for you.

sudo port clean –all installed

sudo port uninstall inactive

The first command will clean all intermediate files needed to compile and install a port and the second will uninstall inactive ports such as old versions.

Uninstalling Macports altogether

If for some reason you don’t want Macports or any of it’s applications on your system, issuing the following commands on your Terminall app will do so for you.

sudo port -f uninstall installed

This will uninstall all your Macports installed software, but you will still be left with files such as configuration files and databases it uses. To get rid of them issue this command.

sudo rm -rf \
/opt/local \
/Applications/DarwinPorts \
/Applications/MacPorts \
/Library/LaunchDaemons/org.macports.* \
/Library/Receipts/DarwinPorts*.pkg \
/Library/Receipts/MacPorts*.pkg \
/Library/StartupItems/DarwinPortsStartup \
/Library/Tcl/darwinports1.0 \
/Library/Tcl/macports1.0 \

More useful info can be found at