Installing and Using pkgsrc on Mac OS X

After spending some time with FreeBSD on my home server, I was impressed enough with the clean implementation of the Ports system that I wanted to use the same base on my Mac OS X development machine. The documentation how to go about it is quite lacking and mainly based on using the prehistoric cvs tool for updating the Ports tree. Using Git for this task feels more natural to me. So here are the (easy) steps, recorded for posterity.

cd /usr/local/
git clone
cd pkgsrc/bootstrap
./bootstrap --pkgdbdir /usr/local/var/db/pkg --unprivileged --prefix /usr/local/pkg

Make sure you don’t have Homebrew’s GNU Coreutils package installed. The install will fail because GNU tsort does not have the -q option, whereas the BSD variant does. Remember: Mac OS X is based on BSD-style Unix.

Updating the available Ports is easy as can be:

cd /usr/local/pkgsrc
git pull