Mac OS X Power Tools

Because Unix is used on wildly different equipment, and because Unix users have traditionally customized their software much more than Mac users, Unix software is normally distributed in source kits. Source kits are basically raw programming code that users can then compileto run on their own system. (Compiling is a process by which source code is processed to run on a particular platform or operating system.) Increasingly, developers have been adding support for Darwin to their source kits, bringing a wealth of "new" software to OS X.

Under OS 9, software was normally compiled by the developer and packaged with an installer before distribution to the user for installation. Unix software installation is a bit more complicated; because of this, there are actually three methods of installing software on OS X:

In Chapter 7, I covered software distributed via the first method. Here's some information on the others.

Because it's so useful, I'll show you how to use Fink in the next section.

Apple's Developer Tools: Required

I mentioned in the Introduction that you should install Apple's Developer Tools on your Mac—either using the CD that came with OS X or your Mac, or by downloading it from Apple's Developer site. For advanced Unix work, the Developer Tools aren't just recommended—they're required. Apple's tools include a current compiler set that allows you to actually build the software we're looking at here.

In addition, once you've installed the Developer Tools, you'll have a host of new programs in /usr/bin. (If you already had Terminal windows open when you installed the Developer Tools, type rehash <RETURN> in each one to recognize these newly installed programs.) If you're curious, type ls -lt /usr/bin <RETURN>, to see a list of things installed along with Apple's compiler. Apple's tools are based on gcc, the GNU Compiler Collection. You can learn more about gcc at http://www.gnu.org/software/gcc/.

Installing Fink

The Fink system is available in two different versions. The Fink Binary Installer is a doubleclickable .pkg file for Apple's Installer, and the Fink Source Release is a pure command-line installer. Both provide a basic set of command-line tools to get Fink running (including the fink program itself), and a set of package files that Fink can use to install other programs. In addition, the Fink Binary Installer includes a selection of pre-compiled packages (to save time) and is based around the dselect and apt-get programs, which provide a text-based menu system to control Fink. (Unfortunately, dselect and apt-get don't work well in Fink yet.) The Fink Source Release uses the fink command instead of dselect and apt-get, and is also able to download, patch, compile, and install software; list installed and available packages; and update itself from the master Internet site. As of this writing, the Source Release is much easier to use.

To install the Fink Source Release, follow this procedure (version numbers and URLs may be different by the time you read this):

  1. Check http://fink.sourceforge.net/ for any warnings or important notes about Fink.

  2. Download the Source Release from http://fink.sourceforge.net/download/srcdist.php. If StuffIt Expander automatically unpacks it, throw away the extracted directory; as of this writing, StuffIt Expander "expands" Fink incorrectly.

  3. In Terminal, cd to the directory where you downloaded the tarball (called fink-0.5.1-full.tar.gz at the time of this writing). If downloads are saved to your Desktop folder, you would type cd ~/Desktop <RETURN>.

  4. Use the tar program to extract the archive by typing tar xzf fink-0.5.1-full.tar.gz <RETURN>. (Remember that the name of the file you download and extract will probably be different than my example here.)

  5. Change to the directory you just created: cd fink-0.5.1-full <RETURN>. (Again, the name of the directory may be different.)

  6. Run the bootstrap.sh script: sh bootstrap.sh <RETURN>.

  7. The bootstrap script asks a series of questions, showing suggested answers in square brackets. To accept the default, just press the return key. Many of these questions concern which mirror sites should be used for downloading source files—local mirrors are generally faster than remote ones, and master sites (listed first by the script), are frequently overloaded. Once it finishes gathering information, the bootstrap script will download the required software, compile it, and install the resulting files in a new /sw directory.

  8. Among other items, Fink installs startup scripts as /sw/bin/init.csh and /sw/bin/init.sh. To activate Fink, /sw/bin must be added to your PATH environment variable; these scripts take care of that and some additional steps to activate Fink. To complete the installation, you'll have to add a line to source the appropriate script to a shell initialization file; the bootstrap script instructs you on how to do this and then exits. If you have multiple users, each user should add the command to their own initialization file, or you can make the change to a shared initialization file in /etc, as described in "Startup and shutdown" in the tcsh manual page. Assuming you are using tcsh or csh, you can also activate Fink for currently running shells with source /sw/bin/init.csh; rehash <RETURN>. (The semicolon allows you to type two commands on one line; it's more compact than typing the first command, hitting return, then typing the second command and hitting return again, but accomplishes the same thing.)

Note 

When you first run the fink command after installation, you may get a warning that the package list is out of date; the error may suggest you type sudo fink index so that it can configure the appropriate privileges and update its list of packages. In normal use, you don't need to use sudo or fink index, as fink keeps its own package cache up to date, and can run sudo for you when needed.

Versions of Open Source Software

Since open source software is often worked on by large, disjointed groups of people, and the development process is much more public than that of commercial software, version numbers of open source software often mean significantly different things than they do with commercial software.

Using the fink Command

Fink provides several subcommands in addition to install, including list (type fink list -i <RETURN> to list installed packages, or fink list name <RETURN> to see packages that match name), and describe (type fink describe packagename <RETURN> to see details on packagename). For a helpful list of fink subcommands, use fink <RETURN>. For more on the fink command, you can read the fink manual page, and the documentation at http://fink.sourceforge.net/.

It's also a good idea (but not absolutely necessary) to periodically type fink selfupdate update-all <RETURN>, which will make fink update its packages to the latest versions via the Internet. The selfupdate subcommand will even offer to get the latest version of the Fink packages from CVS, rather than the latest "released" versions (which may in fact be older).

FinkCommander

If you'd like to control Fink without using the command line, FinkCommander (http://finkcommander.sourceforge.net/) is just the ticket. FinkCommander is a simple program with a graphical user interface that provides a list of available packages, and lets you drive the fink, dselect, and apt-get programs via contextual menus or menu commands. Like fink list, FinkCommander can filter programs by partial name matches, but it also adds sorting and improved filtering capabilities.

Категории