Apple's latest OS now gives you a wide range of software from two different worlds: our beloved Mac and open source. Thanks to utilities like Fink, installation is about as simple on the command line as it is in the GUI.
Fink appeared shortly after Mac OS X started picking up speed and, through constant development by the open source community, has become a powerful utility for installing other open source software. Fink itself is based on open source utilities that have been available under Debian: dpkg , dselect, and apt-get. Those utilities (installed with Fink) can be used seperately, or you can run them together through the made-for-OS X Fink utility. One of the nicer aspects of Fink is that it will install Unix code only in a root directory called sw, ensuring that you won't mess up your current OS X installation (or corrupt existing files).
Since a good portion of the packages available through Fink are shell-based, let's set about installing Fink through the shell as much as possible. These steps were written using Fink v0.40a, the latest release at the time of this writing:
% curl -LO http://us.dl.sourceforge.net/fink/fink-0.4.0a-installer.dmg % open "fink-0.4.0a-installer.dmg" % cd "/Volumes/Fink 0.4.0a Installer/" % open "Fink 0.4.0a Installer.pkg"
The first command uses curl to download the file [Hack #61] into a local copy called fink-0.4.0a-installer.dmg. We then use open [Hack #54] to use the default Finder application associated with .dmg files (typically Disk Copy). Since mounted items are stored in the shell under /Volumes, we move into that directory and then use open again to start the installation process. There's nothing special about the install, so run through this as you would normally. When the installer is finished, we need to prepare Fink's environment. To do so, in the Terminal, type:
% echo 'source /sw/bin/init.csh' >> ~.cshrc
This works under the default tcsh shell, but if you're using bash, add /sw/bin/init.sh to your .bash_profile. When your respective line has been added, open up a new Terminal window so those changes take place, and enter the following (entering your normal password):
% fink scanpackages % sudo dselect
Our final step to setting up Fink is to choose Update Packages at the dselect screen. If you recall, dselect is one of those Debian packages we mentioned earlier; it gives you the ability to choose the packages you wish to install from a console-based menu. Depending on your overall skill with console applications, dselect may be confusing, so this is how you'd update the packages through the Fink utility:
% fink selfupdate
The first time you run this command, you'll have the option of choosing whether you want to look at the CVS for package upgrades. If you're willing to have the latest and greatest, enter Y; if you're panicky about not-perfect-yet software, enter N. The selfupdate command will also check to see if Fink itself has any new updates available and will install them if need be. Depending on your Internet connection and decision concerning CVS, this could take anywhere from a few minutes to more than 20.
Once Fink has updated itself, you'll obviously want to check out the list of available packages for installation. To do so, enter the following, which will display a long list of packages, along with a short description:
% fink list
You can find more information about packages by using Fink's describe flag. Next, we ask for more information about the wget package, where we're rewarded with a few paragraphs, a web site for more information, and the current maintainer:
% fink describe wget
The wget description tells us it's a free network utility to retrieve files from the World Wide Web using HTTP and FTP. It has some advantages over another downloading utility named curl, which is shipped with Mac OS X. To install the wget package, enter the following:
% fink install wget
You'll see a progress report during installation, as well as a lot of output you won't need to understand, but you can add -v to any Fink command line to get even more dirt on what's going on. Software installed by Fink is always located in the /sw directory of your hard drive. Once installation is complete, you can immediately start using your new software. The following two commands will you give more information about wget, and a further example of its use is available in [Hack #61]:
% man wget % wget --help
If you've installed something you don't like, it's just as easy to remove:
% fink remove wget