OSNews recently had two interesting interviews with the leads of the two major Mac OS X Unix porting projects. First up was an interview with Max Horn, who leads the Fink project. The second was an interview with Jordan Hubbard, who leads the DarwinPorts project (and also works at Apple). Both interviews discuss the various goals of each project and where they want to go in the future.
I’ve been a long time Fink user, but after reading a bit about DarwinPorts I decided to give it a try. Honestly I don’t have much loyalty to either project, I just want to get my Unix software working easily. I think this helps me have a relatively unbiased view. Below are descriptions of using the two different tools for the most common tasks: Installation of the tool, package installation, package removal, package upgrading, and searching for packages. If you’ve never used either of these tools, there’s just about enough information here for you to get started.
DarwinPorts is based upon the FreeBSD ports system. However, while FreeBSD’s ports make use of facilities of the make utility, DarwinPorts has been written from the ground up to use the Tcl language. According to the DarwinPorts FAQ, this allows for some interesting information to be extracted from the packages.
DarwinPorts automatically downloads the source files for your chosen package, as well as the source files of packages it depends on. These source files are then compiled locally and installed directly into a quarantined area of your file tree. The DarwinPorts project has also created many Apple Installer packages of their packaged applications. These are available for download and installation from packages.opendarwin.org.
DarwinPorts: Initial Installation
To install DarwinPorts, you must make use of the Concurrent Versioning System (CVS). These Terminal
commands should get you started:
% cd ~/Documents
% cvs -d :pserver:email@example.com:/Volumes/src/cvs/od login
% cvs -d :pserver:firstname.lastname@example.org:/Volumes/src/cvs/od co -P darwinports
There is no password for the anonymous account, so when the first cvs command asks you for a
password, just press Enter. The second command will download the darwinports project from the CVS
server. This process may take a few minutes, depending on your connection speed and how busy the
server is. Once the check out has finished, the following commands will finish up the installation:
% cd darwinports
% sudo make install
% sudo pico /etc/ports/sources.conf
You should now be presented with the contents of the /etc/ports/sources.conf file within
the pico editor. Move the cursor to the end of the line and create an entry that is similar to
file:///Users/username/Documents/darwinports/dports, replacing username
with your user account’s short name. Press the Ctrl+O keys, the Enter key, and then the Ctrl+X
keys. You should now have a base install of DarwinPorts in the /opt/local directory. Do not move
the ~/Documents/darwinports folder around until you are more familiar with the various
DarwinPorts: Installing Packages
The two Unix applications that I use most often are xchat and pan. DarwinPorts contains two versions
of xchat: 1.8.11 and 2.0.1. I’ll be using the latter, which has a package name of xchat2. There is
only one version of pan, which is version 0.13.4. To install these packages, use the port
command as follows:
% sudo port install xchat2
% sudo port install pan
DarwinPorts will check for any dependent libraries and applications of each app and install them as well, all automatically. Once a port is installed, issue the command
sudo port clean package to reclaim disk space used during the build process. For example, after installing xchat2, I’d enter the command
sudo port clean xchat2 to clean up the build files.
DarwinPorts: Removing Packages
Removing installed packages is a piece of cake. Just type in the command
sudo port. To remove my install of xchat2, I’d use the command
sudo port uninstall xchat2. Easy enough, eh?
DarwinPorts: Upgrading Packages
To upgrade a package, you must first remove the existing package as per the previous section. Once
that has been completed, you’ll want to issue the commands below. These commands use cvs to update
your dports collection to the latest releases. Once it’s completed, you simply use the install
procedure above to install the upgraded package.
% sudo port uninstall xchat2
% cd ~/Documents
% cvs -d :pserver:email@example.com:/Volumes/src/cvs/od up
% sudo port install xchat2
DarwinPorts: Finding Software
If you want to see what software packages are available through DarwinPorts, use the following
port search .+ | more. You will be provided with a list of the
packages, their available versions, and a brief description of each. You can also search for
a specific package by supplying all or part of its name:
port search xchat
will reveal the two available xchat packages.
Fink is based upon Debian GNU/Linux’s package management tools: apt and dpkg. The apt tool is used to retrieve packages and their dependencies from the Internet while dpkg does the actual work of installing the various files. Fink takes this a step further by adding the ability to create dpkg packages from source tarballs, compiling the software right on your computer.
Fink: Initial Installation
There are two methods for installing the Fink package. The first uses a binary
installer, which is the easier of the two methods and is recommended for users
who are not as comfortable with the command line interface. Simply download the disk image from the Fink website, mount it with Disk Copy, and then run the Installer package on the image. Follow the prompts and you’re on your way to open source goodness.
The second method uses a source distribution. The Fink website has detailed
instructions for installing the source distribution. Both versions have the same tools, features, and packages, so pick a distribution that you are comfortable with.
Fink: Installing Packages
There are also two methods of installing software packages with Fink. I recommend picking a single method and using it consistently. If you want to save time and don’t mind running slightly older releases, use precompiled packages. If you spending a little more time to install the latest releases of software packages is okay with you, use the source packaging. It’s all a matter of personal preference.
You can install precompiled binaries by using the apt-get tool. To do this, use the command
sudo apt-get install package. For example, to install xchat, I’d use the command
sudo apt-get install xchat. The apt-get tool will go out onto the Internet and download the binary package and then pass it to dpkg for installation. It will also download any dependent libraries or applications and install them as well. One advantage of Fink’s package installation is that you can specify multiple packages on the command line, such as
sudo apt-get install xchat pan.
Fink’s second method of installing software installs from application source. Fink will download the source tarball for the application and compile it. It will then package it and pass the resulting package to dpkg for installation. In case you’re wondering, one reason to install a package the second way is that the version of the package in the source method is often newer than the version available as a precompiled binary.
To install a package via the second method, enter the command
fink install xchat. Just like the apt-get method above, all dependencies are met and installed. (A quick side note: If you are using Apple’s X11 package, you want to install the system-xfree86 package before installing any X11 programs through Fink). Also like the apt-get method, you can specify multiple packages in a single command.
Fink: Removing Packages
Removing a package through Fink is easy. Use
sudo apt-get remove package or
fink remove package. Both commands can be used interchangeably to remove packages installed by either method. Multiple packages on a single command line are possible here as well.
Fink: Upgrading Packages
In order to upgrade your packages in Fink, you must first update your package listing. With the precompiled packages, this means using the command
sudo apt-get update. For source packages, use the command
fink selfupdate-cvs. Once package listings are updated, use
sudo apt-get upgrade to upgrade your precompiled software or
fink update-all to upgrade your source compiled software. It’s worth noting here that these commands will upgrade all software packages in their control. You can update individual packages by specifying which to upgrade. A man on fink or apt-get will get you the right information.
Fink: Finding Software
If you’d like a listing of software packages available through Fink, use the command
fink list | more. Much like DarwinPorts, you’ll see a list of packages, versions, and descriptions. You can also look for specific packages by specifying a package name following list (and dropping the | more).
While it is truly a matter of personal preference, I feel that the Fink project offers an easier install, easier package management, and a larger selection of packages. The fact that I can easily upgrade all of the Unix packages in my Fink distribution with two commands seals the deal. With DarwinPorts, I’d need to issue two commands per package (uninstall, then install, plus a clean) in addition to sychronizing my cvs repository.
That being said, DarwinPorts is perhaps “truer” to Mac OS X’s heritage. Darwin is technically a BSD and Ports is about as BSD as you can get. Well, without counting /etc/rc files ;) Also, apparently DarwinPorts runs on other BSD distributions, quite an interesting venture!
I’m Not Satisfied
I’ve encountered both apt and ports in their original environments (Debian and FreeBSD, respectively) in the past. One problem I found with Debian is that their packages tend to run a little bit behind (i.e. older). I think that Fink has circumvented this issue by adding the ability to compile from source directly. FreeBSD’s ports is a wonderful system, but I feel that it requires a bit more effort than should be needed to keep your software up to date.
After fiddling around with those two OS’s, a friend turned me on to Gentoo Linux. Gentoo uses a package management system called Portage, which is also inspired by the Ports system. Portage handles software installation similar to how Fink does. It keeps a repository of available packages which are synchronized via rsync (instead of CVS) and then builds packages from source. It can also upgrade multiple packages with two commands (
emerge sync && emerge -u world). I find this to be quite convenient.
The other thing I like about Gentoo is that it keeps a system-wide make.conf file. This file allows you to enter gcc optimization flags as well as USE flags. Specifying gcc flags allows you to build for your specific processor architecture. For example, you can specify that you have a G4 processor and want to make use of its AltiVec unit. Upon compiling a package, these extra flags will be specified, giving you that extra bit of optimization. Conversely, DarwinPorts and Fink both build for G3 processors for compatibility’s sake
Gentoo’s USE flags allow you to specify what kind of features you want to compile into your application. As an example, you might specify USE=”-X -gtk -gnome -kde -ipv6 tcpd”. Upon compiling the application, support for X11, GTK, GNOME, KDE, and IPv6 would be left out, but support for tcp wrappers would be put in. This allows you to drop unwanted features for a small performance gain and resource decrease.
With these tools in hand, I challenge you to go out and discover the world of Unix applications. There are a lot of tried, tested, and true tools out there just waiting to gain more users. With tools like Fink and DarwinPorts, installing these Unix utilities is easier than ever (especially when you look at the GUI management tools that are being developed for both projects). While you’re at it, see if you can get someone to start a project which works on porting Portage to Mac OS X :) Enjoy!
This is my second time writing this entry. I actually had my first Safari crash since the v73 beta was released. “Luckily” I only had a few paragraphs done. It’s too bad there’s not a tool like Xjournal that can interface with the O’Reilly weblog interface. Guess I’ll use TextEdit for now.
Which do you use: Fink or DarwinPorts? Have any cool tools you like to use that are available through either?