How-To: Installing and using open-source Unix software in OS X with Fink

Fink is one of several projects that brings easy management of open source Unix programs to OS X.

Thanks to the "Darwin" underpinnings in OS X, Mac users can compile and run many useful open source projects that are available for Unix operating systems. These include everything from command-line tools and editors, to graphical desktop environments and games. While websites such as "Sourceforge" try to make it easy to access the latest versions of open source projects, the projects will still need to be compiled if a binary is not available. Usually this process is straightforward, but at times modifications to the source code and installation scripts may be required to get them running.

Fink is one of several projects that aims to simplify access to open source projects, not only with finding and installing but also with keeping the installed versions up to date. It consists of a local package management application which networks to a number of servers containing source code prepared specifically for the Mac, so no modification to the source or installer scripts should be necessary to compile and run the applications on OS X.

There are several steps to take to get Fink running on your computer, including installing the Apple developer tools, and then compiling the Fink source.

Download and install Apple's developer tools

The Apple developer tools contain all of the libraries and compilers for creating applications in OS X, be they Cocoa applications or command-line tools. While Fink does not need to use XCode and the other other Cocoa development applications themselves, the underlying compilers and libraries that these applications use are required for Fink to install applications from source if a precompiled binary is not available.

The Apple developer tools are available from the Apple Developer Connection website, and require a free ADC membership to download.

Downloading and installing Fink

Once the developer tools are installed, you will need to install Fink. The project has installers available for Leopard and previous versions of OS X, but for Snow Leopard you will need to compile and install Fink from the source code. The instructions for installing either from precompiled binaries or from source are available on the Fink website, but here is the process for installing from source (currently the only option for Snow Leopard).

  1. Download the Fink source files from the link at the top of the Fink source page.

    The Fink source is available as a .tar.gz file.
  2. Double-click the package to extract the source directory (do not edit any files in the directory).

  3. Open the Terminal and use the "cd" command to go to the Fink source directory.

  4. Run "./bootstrap" at the command prompt, and answer all the questions (the default values provided by pressing "enter" at each prompt should be fine for most people in North America).

    Running ./bootstrap will prompt you for various installation options.

    The main decision at this point is to choose whether or not you want the 32-bit or 64-bit version of Fink under Snow Leopard. While most people would get the greatest benefit from the 32-bit version since more projects are 32-bit applications, keep in mind that to switch at a later date would require you to reinstall Fink.

  5. Fink will compile and install by default to the "/sw" directory, which is recommended to keep unless you need to store it elsewhere (ie, an external drive). There may be some mid-install questions asked by the installer, and once started the whole compile and install process should take between 5 and 10 minutes.

  6. After the compile, run the command "/sw/bin/" in the Terminal to update your shell environment with the Fink paths so you can directly access both Fink and the projects you install (this will need to be done for each user in the system).

    These alerts will display when you run the "paths" setup script in the Terminal.
  7. When installation is complete, open a new shell session (ie, open a new Terminal window) to load the new paths, and then run the command "fink selfupdate" to get the latest list of packages. Follow the onscreen instructions and choose the default options (by just pressing enter when prompted) if you are unsure about any step.

  8. Since you do not need to access any of the files in the "sw" folder directly from the Finder, and since it being at the root of your drive may be a bit obtrusive, you can optionally hide this folder by running the following command in the Terminal:

    sudo chflags hidden /sw

Running and Using Fink

Entering the command "fink" by itself in the Terminal will bring up the command's options. You can read details on each command either by going to the Fink website or by entering the command "man fink" in the Terminal. While these documents outline a number of ways to use Fink, the following steps will show you the basics on how to download and install a project from source.

One package I have always liked is "Midnight Commander" (mc), which is a file management utility for the Terminal that is not included in OS X. The steps to install this package are to first see whether or not Fink has it, and then install and run it.

  1. List packages

    The first step is to list the packages that Fink has to offer, by entering "fink list" in the Terminal. There are many packages, so you can filter the list by entering part of the desired package name after the "fink list" command. This option supports wildcards as well, which can further help you narrow down items in the list. Here are a couple of examples:

    List all packages that start with "z":

    fink list z*

    List all packages who's name contains a "z":

    fink list z

    To see if Fink has the Midnight Commander package (which is actually named "mc"), you would run the following command:

    fink list mc

    The "fink list mc" command shows Midnight Commander listed in the middle.

    Sure enough, the Fink project has the package available, so the next step is to install the package.

  2. Install a package

    When you install a package, you will use the "fink install PACKAGE_NAME" command. This will automatically check for and install any package dependencies (libraries and support applications) that the package needs. By default, Fink will do this from source code; however, if you use the "-b" tag in the command (ie, "fink -b install PACHAGE_NAME") it will install a precompiled binary file if one is available (some are, some are not).

    To install the Midnight Commander utility, I ran the following command:

    fink install mc

    When installing, Fink will ask you which dependency to install.

    Fink will check for required files (libraries and such), and if there are multiple options for various dependencies it will ask you to pick which one to use; choosing the default is usually fine (in this case the "aes" version of the library supports aes encryption, but either will do). When your selections have been made, Fink will output the full list of dependencies that will be installed or updated, and will ask for confirmation before proceeding.

    The compilation and installation process may take some time, especially for large packages with many dependencies. For "mc", the process took about half an hour.

  3. Running the program

    Once the compile is complete, you can run the installed program by entering its name directly in the Terminal. In this case, entering "mc" in the terminal loads the Midnight Commander file manager:

    Midnight Commander running in the Terminal after installation.

Benefits and drawbacks of Fink

For a Terminal application Fink is easy to use, which makes it a very convenient option both for novice and advanced users alike who need to use open source software. This is in part because of the very clear step-by-step instructions and information that Fink outputs when it is running. Additionally, since Fink compiles software from source, the software is tailored to run on your computer and not contain code for hardware or libraries you do not have.

With regards to managing installed software, since everything is installed to the "/sw" directory, managing your open source projects is quite easy. Not only does this keep Fink from littering your system folders with source code, but it also enables you to easily uninstall the whole project, source code, and compiled binaries by deleting the entire "/sw" directory.

Fink does have a few drawbacks. While they do as best a job as they can with the on-screen instructions, without a GUI it requires the use of the Terminal, which isn't the most user-friendly environment. Despite this, most fink projects are terminal-based so it might be expected that most people using it should be familiar with the Terminal; however, if you would like a graphic interface for Fink, there are a couple of third-party "wrapper" projects available which may be useful:

  1. FinkCommander
  2. Phynchronicity

Beyond the interface, the only drawback to using the Fink packages and other open source code is that it may not be fully tested. While most projects work very well and perform as advertised, the code is provided "as-is" with no guarantee that it will be bug-free.

Alternatives to Fink

Fink was one of the first package management systems for OS X, and has a structure and organization that I find quite appealing. However, there are a few alternatives available for people to try. MacPorts is another popular Mac-specific package management system which may appeal to OS X users, but in addition there are "pkgsrc" and "Gentoo/Alt", which also run in OS X.

  1. MacPorts
  2. pkgsrc
  3. Gentoo/Alt

Questions? Comments? Post them below or email us!
Be sure to check us out on Twitter and the CNET Mac forums.

Featured Video
This content is rated TV-MA, and is for viewers 18 years or older. Are you of age?
Sorry, you are not old enough to view this content.

Metal Gear Solid V gets a perfect 10

Jeff Bakalar talks with GameSpot's Peter Brown about his perfect 10 review score of Metal Gear Solid V: The Phantom Pain.

by Jeff Bakalar