MacPorts Packages

MacPorts Packages
MacPorts is currently my preferred package manager for Mac OS X. It is more active than Fink and Homebrew (in number of provided packages)

One of the most striking features of MacPorts is that it provides its own libraries rather than relying on the Apple-provided libraries. This increases robustness, at the downside of requiring long dependency lists. While I dislike the long dependency list, I've seen too many migration problems (e.g. with X11 from Xfree to Xorg or from gcc to llvm compiler, and I'm sure that a migration of Python 2 to Python 3 will also introduce some issues) that I prefer MacPort's philosophy to avoid these issues. It certainly helps that MacPorts nowadays provides binary packages, which both reduces the total compile time as well as the number of build dependencies.

For a good manual, see http://guide.macports.org/

Installing a Package
First, get new packages description, and install a particular package:

sudo port sync sudo port install curl port list installed

List Installed Packages
To list all installed packages:

port installed

To list all manually installed packages:

port installed requested

or

port installed requested and active

To list all ports that are not requested, but have no dependents (e.g. no other port relies on it). This typically gives a list of packages that you can uninstall without problems (a common reason how they get installed is due to build dependencies):

port installed leaves

To mark a port as requested:

port setrequested

To delete leaves:

port uninstall leaves

See also Config:MacPorts Packages for a list of currently installed packages.

Build from Source
If available, a precompiled binary of a package is installed. To force the package to be build from source, specify:

port -s

or set buildfromsource always in macports.conf.

Local Builds
It is possible to create a Portfile, and run that build script. Make sure you have a Portfile in a folder with the same name of the port.

E.g. for a port called py-mymod:

cd py-mymod port build

In case the Portfile defines subports (such as most Python and Perl modules do):

cd py-mymod port build subport=py33-mymod

Update
First, download new package descriptions:

% sudo port selfupdate

Then, check for outdated packages:

% port outdated The following installed ports are outdated: gnupg                         1.4.2.2_0 < 1.4.3_0 pango                         1.12.0_1 < 1.12.1_0 subversion                    1.3.0_2 < 1.3.1_0

Finally, upgrade the packages:

% sudo port upgrade installed

Force Rebuild
In case a package is broken, you can force a rebuild:

% sudo port installed php5 The following ports are currently installed: php5 @5.1.4_3+apache2+darwin_8+macosx+mysql5 (active) % sudo port uninstall php5 % sudo port clean --all php5 % sudo port install php5 +apache2+darwin_8+macosx+mysql5

Ports Variants
Packages may have multiple variants. For example, a version with or without IPv6 support. Most packages are default configured with most options enabled, so that the packages has maximum use. However, it may sometimes be necessary to specify a certain option, for example to disable SSL by specifying +no_ssl

% port variants wireshark wireshark has the variants: adns: use adns library for async. dns resolution instead of the default c-ares library gnutls ipv6 libgcrypt libsmi lua no_ssl no_x11 pcre python25: use python25 for the experimental python interface * conflicts with python26 python27 python26: use python26 for the experimental python interface * conflicts with python25 python27 python27: use python27 for the experimental python interface * conflicts with python25 python26 rtp: add rtp support with portaudio universal: Build for multiple architectures

To specify the non-default variant during installation, use the +variant option:

% sudo port install wireshark +ipv6

Replace an installed variant
The following example adds the ipv6 variant to wireshark.

% port installed ethereal ethereal @0.10.14_0+darwin_8 (active) % sudo port deactivate ethereal @0.10.14_0+darwin_8 % port installed ethereal ethereal @0.10.14_0+darwin_8 % port clean ethereal % sudo port install ethereal @0.10.14_0+darwin_8+ipv6 % port installed ethereal ethereal @0.10.14_0+darwin_8 ethereal @0.10.14_0+darwin_8+ipv6 (active)

Installed Files
To find which file installed a particular package:

% port provides /opt/local/bin/xe* /opt/local/bin/xelatex is not provided by a MacPorts port. /opt/local/bin/xetex is provided by: texlive_base

To list which files are installed by a particular packages:

% port contents texlive /opt/local/bin/etex /opt/local/bin/latex /opt/local/bin/pdflatex

Contributions
See MacPorts Trac page for a list of package contributions I made in the past.

List of Useful MacPorts packages
This is a list of packages I've found useful. For a more recent list, see Config:MacPorts_Packages.

LAMP packages
To customize the existing LAMP ("Linux", Apache, MySQL, PHP/Perl/Python) installation, you can use these packages:

GNU replacement packages
To replace the BSD tools with GNU tools, you can use these packages: