Mac OS X MacPorts and Fink software port systems

Like other Unix-based systems, the Mac also has packaging and network repository systems for installing Open Source software.

I have been using the MacPorts system, which is quite nice and has over 6300 packages in source form. Another is fink, which uses Debian tools like dpkg, dselect and apt-get to manage over 2500 packages, both source and binary forms.

In general, just type “sudo port install packagename” to have MacPorts install whatever Open Source programs you want, including end-user apps like R and octave.

The only wrinkles so far have been that packages are sources, so have to be built on your machine (slowly – ‘port upgrade outdated’ is glacial if you have a lot of stale packages installed, so ensure your AC adapter is plugged in), and some common package dependencies, like tiff, require Apple Xcode 3.1 (a free download) or higher to be installed these days or one gets the following fatal error message:

[...]
--->  Extracting tiff
On Mac OS X 10.5, tiff 3.9.1 requires Xcode 3.1 or later but you have Xcode 3.0.
Error: Target org.macports.extract returned: incompatible Xcode version
[...]
Error: Status 1 encountered during processing.

Xcode (and MacPorts) are not updated from Mac OS X Software Update, so you must do that manually. Obviously that is a potential security problem.

Some handy port commands

# see what ports are available

port list
port list all

# see what ports are already locally installed

port installed | grep -v xorg

# commonly-used packages for developers

sudo port install vim lynx links wget aquaterm htop

# easy way to install X11 and most common package dependencies in about 2 hours, so use an AC adapter

sudo port install octave r

# for Internet engineers (yes, PHP 5.3.0+ with Apache2 is installed …)

sudo port install apache2 php5 mysql5 squid lighttpd nginx pound varnish webalizer wget wireshark

To activate PHP5:

cd /opt/local/apache2/modules
/opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so

To configure daemons like apache2 to start at boot time and also start immediately, first edit the respective configuration file (on notebooks I usually restrict listening to 127.0.0.1), then:

sudo port load apache2

# update MacPorts system

sudo port selfupdate
sudo port upgrade outdated

If you want to use vector graphics in an AquaTerm with gnuplot or octave, you may need to start AquaTerm first, or set the following envariables in your .profile startup script:

GNUTERM=aqua
GNUTERMAPP=/opt/local/var/macports/software/aquaterm/1.0.1_5/Applications/MacPorts/AquaTerm.app

MacPorts FAQ
Ryan Schmidt’s comments on tiff and the dependency on Xcode 3.1

Fink can be tricky to install with a securely configured Mac, but installation can be done from the command line easily:

hdiutil attach Fink-0.9.0-Intel-Installer.dmg
sudo installer -pkg "Fink 0.9.0-Intel Installer.pkg" -target /
/sw/bin/pathsetup.sh
fink selfupdate
fink --version
fink list

macosx.com: How to Install a .dmg File At a Command Line?
Install Apache 2 and PHP 5 with MacPorts

Install Tsoft for WINDOWS on your Mac with WINE via MacPorts Project

ocf.berkeley.edu: Security Issues concerning X

2 Responses to “Mac OS X MacPorts and Fink software port systems”

  1. Mike says:

    Just hit the TIFF issue this evening.

    Unfortunately, XCode 3.1 doesn’t seem to be available for download any more except for registered iPhone developers, and 3.2 is Snow Leopard only, which leaves me up a certain creek without a certain implement.

  2. Hi Mike.

    You can register for a free Apple Developer account, then use google instead of the ADC search to find a useful Xcode 3.1.3 download link, and then you can download prior XCode versions.

    I had to do that for my notebook running Leopard.

    However, that still won’t solve the few dependencies on small but critical libraries that I notice from time to time. I have no idea why MacPorts doesn’t have binary packages these days.

    MacPorts is great overall, but slow, though.

    Good luck.

    Thanks, James.

Leave a Reply