Enterprise Software

Install open source software on your Mac easily with Fink

Vincent Danen recommends Fink, a program which makes it easier to install open source software on OS X systems.

Coming from a Linux background to OS X, the greatest thing about OS X that intrigued me and got me to use it in the first place was the fact that it was built on a BSD core, which meant I could use the many Linux applications that I was familiar with and could muck around with the internals with a fair degree of familiarity. Of course, OS X and Linux are quite different which made, in the early days of OS X, compiling open source software something of a challenge.

Systems like MacPorts and Fink were created to make it as easy to install open source software on OS X as it is on Linux or FreeBSD. Of the two, I opted for Fink as it used familiar tools for package management: apt-get and the Debian dpkg standard. In this way, Fink provides pre-compiled binaries that are quick to install, and also allows for source-builds through its own package management building system, aptly called fink. What fink compiles, it puts into Debian packages for apt-get to install, making it easy to manage installed software using the Debian tools.

Installing Fink is very simple. The only prerequisite is that the Apple Xcode Tools must be installed. Once Xcode is installed, download the fink source tarball and follow the instructions which are summed up as follows:

$ tar xvzf fink-0.29.10.tar.gz
$ cd fink-0.29.10
$ ./bootstrap
$ /sw/bin/pathsetup.sh

This will bootstrap Fink to compile a working Fink environment. There are questions as to mirrors and proxies and such; the bootstrap process explains the options in detail as they are presented.

Once this is done, you must tell Fink to update its package information, which is done using:

$ sudo fink selfupdate

Now, re-run the configuration process. This will allow you to enable the unstable repository, which provides a lot more packages than what stable provides:

$ sudo fink configure
$ sudo fink selfupdate
$ sudo fink update-all

These three commands will provide a fully up-to-date basic Fink environment. Coming from Linux, I much prefer the GNU variants of ls, cp, and other common commands than the BSD variants OS X ships with. Because the Fink binaries will come first on the path (via a modified $PATH setting which comes as part of the pathsetup.sh script), we can use Fink to install the coreutils package, which provides the basic GNU tools I prefer:

$ sudo install coreutils

Unfortunately, coreutils is an odd one. The binaries are installed in /sw/lib/coreutils/bin/ rather than /sw/bin/; if like me, you'd prefer to use the GNU commands over the BSD ones, the fix is simple:

$ cd /sw/bin/
$ for x in $(/bin/ls ../lib/coreutils/bin); do sudo /bin/ln -s $x .; done

This will create symbolic links of all the binaries in /sw/bin/; there will be one or two "file exists" errors due to the pre-existence of some binaries (such as md5sum).

Finally, here are a few useful commands when installing software with Fink:

  • dpkg -S [file]: find which package owns [file]
  • dpkg -l: lists all installed packages
  • fink remove [package]: uninstall a package
  • fink apropos [string]: lists all packages with [string] in the package name

Fink is great. With it, I can have the latest Subversion, Git, the Joe text editor, even the Apache Web server, complete with PHP modules. The command interface is really easy, and the fact that it remains in a distinct directory of it's own (/sw) is very much appreciated. If you do break something, simply remove the /sw directory and start over, or if Fink isn't for you and you no longer want it, uninstall by removing that same directory and there is nothing left over to worry about removing (other than perhaps a few shell startup scripts such as ~/.profile).

About Vincent Danen

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

Editor's Picks

Free Newsletters, In your Inbox