title
brancg
adam_ev
oped resources forums contacts subscribe site_map home
 

forums


OpEd

All Mac Considered
Amen Corner
Apple Peel
Digital Canvas
Editorials
iMaculate
   Conception

Infinite Loop
The JunkMan
Notes from Dis
Scientia et
   Macintosh

Skewed Mac
Terminal Mac

Resources

Books
Contacts/Mission
Forums
Links
Reviews
Subscribe


Applelust is looking to add writers to its staff. If you are interested or want to be part of the Applelust community, drop us a line with your resume or vita. We are always on the look out for good, very smart, and reliable people to join the staff. If you think you have what it takes, let us know.

- The Publisher

OS X World
Safe and Happy UNIX Hacking with MacOS X: Fink

© 12-7-01 Andrei Verovski

Preface

MacOS X version 10.1 lacks package management system similar to RPM or Debian APT which tracks system components in central searchable databases (maybe Apple will fix this in one of the next versions). This makes quite difficult maintaining UNIX inherited software, which may consist of hundreds and even thousands of files scattered across MacOS X UNIX-specific system directories not even visible in MacOS X Finder. However, thanks to the Open Source community, managing some UNIX software becomes much more easier, and, what is very important, safer.

What is Fink?

Fink is a MacOS X port of package management system APT (Advanced Package Tool), package manager dpkg, and some front-ends for these tools from Debian/GNU Linux. However, this is only a part of what Fink does for MacOS X. The greatest feature of Fink is that it creates its own UNIX directory tree (separated from MacOS X) where it keeps all its files.

Fink, as well as all UNIX software properly packaged with Fink (except Darwin/MacOS X versions of XFree86 windowing system) do not install anything into MacOS X system directories (including "/usr/local") or alter any MacOS X system file(s). Thus, it is completely safe. If something goes wrong, one can just erase entire Fink directory without damaging MacOS X. However, please take into account that Fink does not track MacOS X native components, only software installed with Fink itself.

UNIX Directory Tree

The UNIX directory tree is very different from the classic MacOS. Here is a short list of directories whose purpose is more or less common for all UNIX variants:

/
Root directory, everything, including mounted volumes (in UNIX they are represented as directories) is inside this directory.
/bin
Binaries needed to start up OS
/dev
Device files
/etc
Configuration files, analog of Preferences folder in classic MacOS. UNIX configuration files are plain text files and thus, may be viewed and modified using text editor.
/home
Private directories of the users, in MacOS X it is named "Users".
/sbin
System binaries reserved to the superuser
/lib
Shared libraries, in MacOS X named "Libraries".
/usr
UNIX system resources. This directory includes essential UNIX components like source code, help files, various scripts and executables.
/tmp
Short-term temporary files.
/var
Variable data (mail, databases, print spool files, log files, etc.) belonging to certain software packages (mail/Web/database servers, print spoolers, etc.).

Please note that directories listed above are not necessary located in the root level (like on Linux). Many of these directories in MacOS X are inside directory called "private" which is hidden by MacOS X Finder. UNIX file and directory names are case sensetive, directory names are separated with slash "/", invisible items start with a dot ".", that's why they are often called dot items by UNIX users.

All UNIX related directories and files of MacOS X (hidden when MacOS X is running) are visible and modifiable from classic MacOS resource editor like ResEdit. However, editing MacOS X components from classic MacOS is really bad idea.

Installing Fink

If you have software from OpenOSX.com (Database, Web or GIMP CDs) or MacOSX.Forked.net you should remove them first! Some stuff from above mentioned companies is created with Fink and then repackaged for MacOS X.

Installing Fink is quite simple. Since Fink is a quickly evolving software, and you may use different versions, and the installation procedure might be different. Fink distribution is supplied with an excellent manual, so just look into it.

For version 0.3, launch Fink installer, wait until it finishes, then create a text file named ".cshrc" (beginning with dot ".") containing the line "source /sw/bin/init.csh" in your home directory Users -> Your Name (run "echo "source /sw/bin/init.csh" > .cshrc"). Finally run "rehash" in terminal. You will find "/sw" directory in the root level of your startup volume. This is where Fink keeps all its stuff.

Please note that Fink requires Apple Developer Tools and MacOS X SDK (both are parts of MacOS X Developer Tools CD available for free download) to be installed.

Upgrading Fink Core to the Next Release

Run "fink selfupdate" in terminal. This time (version 0.3 release) it is the only right way to upgrade the Fink core in auto-pilot mode to the next release. You should not use the MacOS X installer program and MacOS X Fink package for upgrade purposes (only for first time installation). To upgrade the rest of Fink installed components run "fink update-all".

Getting Started

  1. This article assumes that you have at least basic knowledge of UNIX and terminal commands.
  2. Almost all commands below must be executed in superuser mode (look here how to gain root access in MacOS X).

Please note that you need fast Internet connection to fetch source tarball(s) and Fink packages from the master site. Run "fink list" in order to see a list of available Fink packages. To install (or upgrade) already precompiled Fink-enabled packages I may advise to use dselect (console based front-end to the Debian package manager dpkg). It is quite confusing for novices, but very capable and powerful.

First of all, run Update command in dselect (or "apt-get update" in terminal) to fetch list of precompiled Debian-style packages which are usually referred as debs (but do not run Access, it may overwrite Fink settings!). Then, in Select section choose (with + key) whatever you what to install. And finally, run Install. The dselect will automatically resolve dependencies, download and install necessary components.

If you find dselect too cumbersome, just run "apt-get install package-name" in terminal (but do not forget to run "apt-get update" first !). If "apt-get install package-name" fails to install known package, it means that selected package is not available yet as precompiled deb from Fink master site, it have to be downloaded as source tarball and compiled locally. In this case you should run "fink install package-name". Please take into account that this process my be very time consuming.

Brief list of some Fink, apt-get and dpkg commands is available below.

Command Description Notes
fink list Lists available Fink packages At the time of Fink version 0.3 release 227 packages available
fink describe package-name Prints comprehensive description of specified package  
fink install package-name Downloads source tarball, compiles, and installs compiled deb package 1) Checks package dependencies; 2) might be very time consuming, use "dpkg --install" instead
fink build package-name Downloads source tarball if it is not present and builds deb package No installation performed
fink rebuild package-name Works like "fink build", but replaces current deb package Automatically upgrades package with the newest build if another one was installed before
fink remove package-name Removes specified package Warning !!! Does not check dependencies (Fink version 0.3 and below), so be very careful, use "apt-get remove", "dpkg --remove" or "dpkg --purge" instead
fink selfupdate Updates Fink and its core components This is the only right way to upgrade Fink core to the new release!
apt-get update Fetches lists of available deb packages from master site  
apt-get install package-name Downloads and installs specified deb package Preferred method of installation, but do not forget to run "apt-get update" first!
apt-get remove package-name Removes package Preferred method of removal, checks package dependencies
dpkg --install package-name Installs selected deb package Checks package dependencies, but do not fetches dependent items
dpkg --remove package-name Removes package, but leaves configuration files Checks package dependencies
dpkg --purge package-name Removes package and its configuration files Checks package dependencies
man fink
man apt-get
man dpkg
Displays manual pages for Fink, apt-get and dpkg respectively  

What is the difference between "apt-get install package-name" and "dpkg --install package-name" one may ask? "apt-get install ..." will search for the specified package in the known package list and then will download and install it (example - "apt-get install mysql"), while with "dpkg --install ..." it is required to explicitly specify file name and path of the deb package (example - "dpkg --install /Users/Shared/mysql_3.23.43-2_darwin-powerpc.deb"). Both perform checking of package dependencies, but only "apt-get" will automatically fetch and install dependent items. In short, "apt-get" is preferred over "dpkg" whenever possible because it is higher-lever tool.

Another Fink Benefit

Fink may install some very useful Open Source UNIX software which is missing from MacOS X (or is just incomplete) like bzip2 (Burrows-Wheeler block sorting compressor with Huffman coding), wget (http/ftp recursive file retriever), tar (tape archiver which really works), Midnight Commander (very popular among Linux/FreeBSD users console based file manager), MySQL/PostgreSQL (powerful open source SQL database servers), and much much more, all this (except XFree86 installation) without altering MacOS X system directories.

Creating deb Packages for MacOS X/Fink

Full and comprehensive instruction is available at Fink Web site, however, it assumes that you are a UNIX programmer. Below you will find some explanation how to quickly build your own deb without digging deep.

In short, you need to place source tarball and package description file into proper directories and run "fink build package-name". The top level build directory is "/sw/finks/dists". It contains 3 subdirectories (let's call them release status trees) - stable (final or stable releases), unstable (beta, testing or experimental releases), and local (releases built locally by administrator). Most likely all your home brewed software will go into local. Each release status tree contains two subdirectories - finkinfo (for package description files and patches) and binary-darwin-powerpc (for compiled deb packages). All source tarballs must be placed into "/sw/src/", or you may specify download URL in the package description file. Writing package description file from scratch may be rather tricky, so it is much easier to modify existing ones. For example, Fink 0.3 have been supplied with MySQL 3.23.42 without InnoDB, but I am needed MySQL 3.23.44 with InnoDB transaction safe table support. I have had to change just few lines in package description file (version #, revision #; and add compilation configuration parameter "--with-innodb").

Q&A

Q. What to do if one want to rebuild an existing Fink package but with different compilation options?
A. Modify existing *.info file (increment revision number) and copy it into local tree, then run "fink build package-name", "dpkg --install package-name".

Q. How to tinker with stuff from the unstable tree (beta, testing, experimental, etc.)?
A. Copy desired package description (*.info) and patch (*.patch) files from unstable tree "/sw/fink/dists/unstable/..." to local one "/sw/fink/dists/local/..." and run "fink build package-name".

Q. The package I am looking for seems to be not available.
A. 1) Look in the unstable tree; 2) create it yourself.

Q. I am running "fink build package-name", but Fink tries to compile and build a lot of dependent packages, it will take hours or even days !!!
A. Fink build tool is not advanced enough yet and it does not check if precompiled dependent packages are available (at least this is true for Fink version 0.3). There are two solutions: 1) install existing package (if it exists, of course), with "apt-get update", "apt-get install package-name", then upgrade to your own version or revision; 2) manually install dependent packages with "apt-get update", "apt-get install dependent-package-name".

Q. The "apt-get install package-name" fails to install known package (error message - package not found). What to do?
A. Please read this article carefully again from the beginning.

Q. How to install XFree86 with Fink?
A. Excellent guide called "Running X11 on Darwin and Mac OS X" written by Christoph Pfisterer is available here.

Q. I have a problem with Fink and could not figure out how to solve it.
A. 1) Study Fink manual, other resources and be creative; 2) subscribe to the Fink mailing lists and ask there for help. However, please be patient and polite, and don't get mad if you won't get desired answer. Nobody is obliged to help you unless you paid for support contract. After all, you got Fink software for free.

Credits

Everything described here would not be possible without the great work of talented programmers - Christoph Pfisterer, Max Horn and all others, who developed a port of the package management system from Debian/GNU Linux (one of the most powerful and advanced these days) for MacOS X. This port is called Fink.

Andrei Verovski

What do you think? Talk about in our Forums... We have a new 10.1 Forum.

 

Vote Applelust Best of The Web

  • Stuffit 7 (10-18-02) Dr. Neale Monks. What purpose does file compression have in this day of 100 GB hard drives? Is version 7 worthy of the upgrade fees?
  • Fireworks MX (10-8-02) Dean Browell. Fireworks is more than just a pretty face; The last app I needed to convert entirely to OS X delivers in upgrades and features as well...
  • Dreamweaver MX (10-8-02) Joel Davies. Not being satisfied with just carbonizing it's product, Macromedia made sure that Dreamweaver MX was the killer app for web design.
  • SliMP3 (9-6-02) Pat St-Arnaud. The SliMP3 is a small, simple and elegant network devices that connects to any audio component with RCA inputs and lets you browse, search and play music directly from your computer's MP3 collection.
  • Voyager III v.3 (8-16-02) Dr. Neale Monks. Carina's Voyager is the grandfather of Mac planetarium programs, but does it still have what it takes to keep up the current generation?
  • CodeWarrior 8 (8-16-02) Douglas A. Welton. Doug dives into the latest version of this robust multi-platform programming tool.
  • STM Sports Backpack (8-9-02) Pierre Igot. How will this backpack designed for the "global digerati" stack up when Pierre puts it to the test with his mobile digital lifestyle?
  • Scope Driver (8-2-02) Dr. Neale Monks. An alternative to the 'point and click' telescope control paradigm: a powerful list-based utility for Autostar and LX200 telescopes.
  • Apple Final Cut Pro 3.0 (7-19-02) Michael Tate Jones. Tate reviews the video-editing powerhouse Final Cut Pro 3 and sizes up its competition. Does Final Cut Pro 3 hold its ground?
  • Strata DVpro RME (7-16-02) Matt Frederick. Matt Frederick. Matt takes a comprehensive look at Strata DVpro, Strata's pro-level non-linear editor for digital video.
  • Stargazer's Delight (6-28-02) Dr. Neale Monks. Looking for a viable shareware alternative to the big commercial astronomy software packages? Neale may have found one.
  • TheSky (6-21-02) Dr. Neale Monks. Neale takes a look at the easiest to use planetarium program for the Mac.
  • NI FM7 (6-21-02) Matt Frederick. Matt takes this software replica of Yamaha's DX7 synthesizer for a test drive.
  • Griffin's iMic and other USB audio devices (6-14-02) Pierre Igot. Do Griffin's promises of significantly superior audio input and output performance ring true?
  • The Digital Universe (6-14-02) Neale Monks. Planetarium program, astronomy encyclopaedia and space flight simulator all rolled into one - could The Digital Universe be the ClarisWorks of astronomy software? Neale Monks takes a look.
  • After Effects 5.5 (5-31-02) Michael Tate Jones. Tate reviews the OS X native version of After Effects and likes what he sees.
  • InDesign 2.0 for Non-Professional Designers (5-24-02) Pierre Igot. In the second part of our review of Adobe InDesign 2.0 for Mac OS X, Pierre Igot looks at InDesign from the point-of-view of the non-professional designer - and finds plenty to like.
  • Corel Graphics Suite, Part 2 (5-24-02) Dean Browell. CorelDraw returns in full force and Corel R.A.V.E makes its debut.
  • Corel Graphics Suite, Part 1 (5-17-02) Dean Browell. CorelDraw is back, and it's brought some powerful friends that makes this Suite worth the look...
  • OmniGraffle 2.0 (5-10-02) András Puiz. Analog napkins are so 20th century -- this gem from OmniGroup knows (almost) all about diagramming. András Puiz wishes all Mac developers developed a similar understanding of Aqua, and of Mac OS X in general.
  • Watson (5-03-02) Michael Tate Jones. Tate discovers a 'Swiss Army Knife' for OS X... it's called Watson.


©2000-2002 Applelust.com. All rights reserved. No part of this publication may be reproduced in any way without prior, expressed permission from the Publisher. It is the sole property of Applelust.com and its writers, who retain copyright to their own works. If you wish to link to us, please see our Privacy Statement for conditions. Apple, Macintosh, and Mac are trademarks of Apple Computer, Inc, with whom we are in no way affiliated or endorsed.

Hosting provided by itsamac.com -- Macintosh Powered Web Hosting

Serve Different

dreamy