Chapter 13. MacPorts

The MacPorts project (, formerly known as DarwinPorts, is a package management system that is similar to Fink and the FreeBSD ports collection ( and is hosted by Apple, Inc. Written primarily in Tcl (which is bundled with Mac OS X), MacPorts automates the installation of open source Unix- and Aqua-based software on Mac OS X.

MacPorts provides a way to both install and remove packages, called ports, from its collection, as well as a way to track package dependencies. This means that if you attempt to install package A, and package A depends on package B, MacPorts finds and installs package B first and then goes back and installs package A. Similarly, if you attempt to uninstall package B but you have installed another package that depends on package B, MacPorts warns you about this dependency and gives you the option to remove other packages that depend on the one you’re attempting to remove.

MacPorts installs Unix-based packages in /opt/local by default, ensuring that your Mac OS X-installed system files in /usr won’t be affected. You can also use MacPorts to build from source several Aqua-based applications, which MacPorts installs in /Applications/MacPorts. Additionally, required libraries are installed in /Library/Tcl/macports1.0. If problems occur with MacPorts-installed packages, you can delete the entire /opt/local directory tree without affecting your system. In that case, you should also delete the /Library/Tcl/macports1.0 ...

Get Mac OS X For Unix Geeks, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.