Donate to Wikipedia

Transform a Mac into an Open-Source Server

The MacPorts.info Tutorial

MacPorts Installation & Configuration

MacPorts requires Mac OS X 10.4.x and Apple’s Xcode programing suite. If you are not running these, please refer to the Mac OS-X instructions in the menu at left. Otherwise go to http://www.macports.org/ and follow the Download links - at the time of writing, this took you to:

http://svn.macosforge.org/repository/macports/downloads/

Download the latest package and run the installer.

Install Location:

The MacPorts installer copies MacPorts to the target directory /opt/local. If you wish to install to any path other than that, you must install MacPorts via its source code. See Installing MacPorts on the MacPorts Wiki for instructions on installation alternatives.

What is Installed:

Aside from a few MacPorts executable commands in /opt/local/bin, most MacPorts files are installed in /opt/local/var/macports. Within these directories you will find a “sources” directory containing the Portfiles that hold the necessary instructions to install individual ports, and also the source code for MacPorts itself. Both are kept up to date by using the port selfupdate command as shown below. Please read the port(1) man page for more information.

Shell Environment:

A file named ~/.profile is created for the “bash” shell (default on Mac OS X 10.3 and newer) during the MacPorts installation. It contains the necessary statements to append MacPorts’ binary paths within /opt/local/ to your shell environment, so MacPorts is available to you on subsequent terminal sessions. You may have to quit and restart your terminal application for this change to take effect.

When you are done, go to the command line, and type:

sudo port selfupdate

You can now proceed with tutorial, by clicking on the next item on the menu to the left. You may notice that there is now a directly called opt at the root level of your drive - this is where MacPorts is located and everything that you will install under this tutorial. Any Apple OS X updaters will not modify this directory.

If you want to search for a particular package, then enter the following on the command line:

port search <portname>

If you find a package you want to install, you can simply enter the following on the command line:

sudo port install <portname>

If you want to see what ports are installed and active, enter the following on the command line:

port installed

Documentation:

The MacPorts Wiki is available at: http://trac.macports.org/projects/macports/ and should be consulted for further documentation and support. Also provided are man pages for port, macports.conf, portfile, portgroup, portstyle, and porthier. These can be invoked by typing: “man” followed by the name of the command or file (e.g. “man port” or “man macports.conf”).


Killer tools to troubleshoot DNS and Email