Mac OS X Unix Package Management

by Jason Deraleau


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



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:anonymous@anoncvs.opendarwin.org:/Volumes/src/cvs/od login
% cvs -d :pserver:anonymous@anoncvs.opendarwin.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
% make
% 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 tools.


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
uninstall package
. 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:anonymous@anoncvs.opendarwin.org:/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
command 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



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).


The Verdict



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.


Closing Up



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!


P.S.



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?


15 Comments

dieringer
2003-04-19 10:31:08
Thanks Jason!
This is the first comparison of the two package managers I've seen. Any comments on Fink Commander? Since I'm not a programmer (or comfortable with the command line) I am interested in the Fink/Fink Commander combo now that the Virex use of /sw has been solved.


My main interest is in using Gimp and a few of the other more popular X progs...


Steve

anonymous2
2003-04-19 16:15:10
gnu-darwin
Any such treatment of packaging system is incomplete without mention of GNU-Darwin, especially considering that we have over 10,000 unique sofware titles available for Darwin and Mac OS X.


BTW, we did not drop support for OS X.


Regards,

proclus


http://www.gnu-darwin.org/

rangerrick
2003-04-20 15:07:58
GUIs, and What I Use (was Thanks Jason!)
FinkCommander is pretty nice, and can actually do some things (forcing removal of packages, for example) easier than the fink command-line tools.


DarwinPorts also has a GUI, although like dports, there's still a lot of heavy development going on in the tools, dports has a lot of infrastructure work going on still.


I think eventually, dports has the opportunity to incorporate the best of gentoo, fink, and ports. They've got a solid design and they're not afraid to start fresh to make things cleaner in the long term.


In the meantime Fink is what I use, and develop on (if you recognize the nick, I'm the fool who maintains the most packages currently :) Fink is definitely (in my obviously biased opinion) the best thing available now, and really does simplify things immensely. I do watch dports closely though, and have actually made a number of the ports in it.

jafager
2003-04-21 08:30:25
Or I could bang my head against the wall until my brains spill out...
The one time I tried to find something on the GNU-Darwin site all I found was a lot of self-congratulatory blathering about the project's opposition to the war in Iraq and no links to useful information.


Wasting people's time is not the way to win friends.


jafager

anonymous2
2003-04-21 14:14:40
Or I could bang my head against the wall until my brains spill out...
Perhaps you should take another look?


http://www.gnu-darwin.org/


Regards,
proclus

anonymous2
2003-04-21 17:32:44
Or I could bang my head against the wall until my brains spill out...
Didn't take long to find this quite offending article on gnu-darwin. Anti-war blackout by Dr. Michael L. Love, Wed, 19 Mar 2003 22:48:52


This is a dead project in my mind. Stick to code and leave the politics alone.


Eric (U.S. Navy Submarine Force, Retired)

anonymous2
2003-04-21 18:49:02
Or I could bang my head against the wall until my brains spill out...
Dream on! GNU-Darwin will continue as an activist distribution, and contrary to opinion in some quarters, it is still very much alive. Sorry to hear that you find that offensive, but that will not change these facts.


US action in Iraq is offensive to freedom itself, and people of good conscience will continue to oppose it. US out!


Regards,
proclus
http://www.gnu-darwin.org/

tpherndon
2003-04-22 11:54:32
Cleaning
You mention that a dports user needs to enter a manual clean-up command to remove excess files after an install from source. Does Fink require something similar?


FWIW, I use neither dports nor Fink on my Mac here at work, but I do use Gentoo on my Intel machine at home, and yet another nice feature of Portage is its ability to set an auto-clean flag in make.conf. In fact, I'm rather appalled that dports forces you to run manual clean-ups. Is there a way to configure that setting, perhaps? If not, PLEASE implement it!!!

anonymous2
2003-04-22 14:42:06
GNU-Darwin still quite alive
unstoppable
proclus
2004-03-12 07:55:14
GNU-Darwin: blackout anniversary
On this day last year we announced our intent to blackout in protest of
US aggression in Iraq. All of the major points of our argument have
been vindicated, while the Bush administration has spent the past year
back-pedaling, whitewashing, and covering up the many lies that they
have told. If you are interested in revisiting the rationale for the
GNU-Darwin anti-war blackout, it was formalized and generalized in a
short essay the following April .


http://proclus.tripod.com/radical/wartext4.html


Condolences to the people of Madrid. If only they could have stopped
their government from supporting the war, then today's tragedy would
never have happened.


Regards,
proclus
http://www.gnu-darwin.org/

jldera
2004-03-12 07:59:39
GNU-Darwin: blackout anniversary
Please take your political agenda elsewhere. This is not an avenue for you to express or advertise your views. The intent of this article and its talkback is to discuss the technical aspects of Mac OS X Unix Package Management, not world events. Thank you.
carboncopy
2004-12-21 06:16:23
darwinport
I install fink in April. Never get around to using it. finkcommander just turn me off.


I resorted to manually downloading the source codes and compile.


A few weeks back, started using darwinports. Just love the command line. :)


If I would have read a bit more about fink earlier. I may have stick to it. Then again, I have bad taste of debian a few years back. Am Slackware user.


Therefore, I go for BSD (like) system.

den
2006-02-16 10:45:24
Thanks
Good comparison; I have used both installers on mac os x and found dp to be a little bit of a pain from the terminal. I've just started using Debian on an old laptop and find that the terminal 'aptitude' program does a great job of installing debs (dpkg's). Is there a version of aptitude available to the mac, can't remember one (found fink to be a little slowwwww at times).
pmocek
2006-02-22 23:23:43
There is an Aptitude package for Fink. See the Fink package database for details.

2006-05-18 13:57:50
I recently deleted everything to do with fink and darwinports from my mac os x system. Whilst they initially seemed like an appealing way to get all my favorite linux apps, I don't really like the idea of having several independent directory structures and install methods on my system. It just makes it confusing when you want to upgrade or remove software, and you have to be careful to make sure the packages installed by different methods can talk to each other.


I actually went even further than that and removed X11 from my system as well. The reason is that you can usually find Coacoa/Aqua/native Mac versions of the most common open-source apps. Switching to these means that you only have to deal with the usual OS X installation methods, and you get a uniform user interface across all the apps on your system.


TeX/latex users unfortunately still have to deal with the dreadful i-installer package management programme, because this is the only easy way to get the recommended up to date TeX distribution. If someone develops a way to get TeX working with standard Apple installation methods then I would be a very happy man. In fact, I think there would be a good argument for Apple to develop its own TeXing system, which could be included as an optional extra with the OS X disribution in a similar way to the XCode tools. I am sure they would do a much better job of integrating it with the standard OS X tools (e.g. Preview) than the current solutions do (e.g. TexShop or Aquamacs).