|
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
 |
-
This
article assumes that you have at least basic
knowledge of UNIX and terminal commands.
-
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.
- MacBook
Pro (5-17-06) Dr. Neale Monks. A subjective review of the MacBook
Pro
- Freeway 4 Pro (2-28-06)
Dr. Neale Monks. Freeway Pro, the Quark-like web design program from Softpress,
has been substantially revised and sports a bright new look. But do the changes
go more than skin deep? Neale Monks finds out.
- Astrostack (1-18-06) Dr. Neale Monks. Long respected as one best astronomical image processing applications about, in its newest incarnation AstroStack now runs on the Macintosh. Has the wait been worthwhile?
- Virtual PC 7 (11-23-05) Dr. Neale Monks. Virtual PC 7 is the update to the venerable Windows emulator to be entirely all Microsoft’s own work. Can Mac users expect to see any dramatic changes?
- Eudora Pro 6.2 (8-5-05) Dr. Neale Monks. Eudora has been one of the most popular e-mail clients for the Macintosh for more than a decade. Neale Monks finds out how it compares with the Mail application that comes with OS X
- MacAstronomica (4-22-05) Dr. Neale Monks. How does this amateur naked eye astronomy software stack up?
- iKey 2.0 (3-11-05) Jeremy Young. How well does this automation
utility work? How much time will you save?
- Wolfram Research Publicon (3-11-05) Jeff Terry Does this new scientific
word processor live up to the potential?
- Microsoft
Office 2004, Part 3, Word (1-28-05) Dr. Neale Monks. Are there enough
new features to necessitate a jump from v.X?
- REALbasic
5.5 (12-03-04) Dr. Neale Monks. Neale takes a look at the latest version
of this programming package.
- Office
2004, Part 2, Excel and Entourage (11-05-04) Dr. Neale Monks. In the second
part of his review of Office 2004, Neale Monks looks at Excel and Entourage.
-
Phone Valet 2.0 (11-05-04) Pat St-Arnaud. The best question to ask might
be "Is there anything that you can't do with this telephone/Mac integration
tool?"
- TiPaint
Touch-up Kit and iKlear iPod Cleaning Kit (10-29-04) Dr. Neale Monks.
Is it possible to restore the shiny good looks of iPods and PowerBooks even
after years of use? Neale Monks looks at two cleaning products designed especially
for Apple hardware.
- Microsoft
Office 2004, Part 1, PowerPoint (10-15-04) Dr. Neale Monks. In the first
part of his review of Office 2004, Neale Monks looks at PowerPoint, for many
people still the benchmark for presentation software.
- ScrapX
(9-17-04) Dr. Neale Monks. Aqueous Software's ScrapX brings the Scrapbook
to OS X
- CDFinder
(8-20-04) Dr. Neale Monks. Finding what you want from among a stack of similar
looking CDs can be a hassle, but help is at hand. Neale Monks looks at CDFinder,
a budget-priced but powerful cataloguing tool.
- Endnote
7 (8-13-04) Dr. Markus Geisen. EndNote 7 is a literature database that
seamlessly interacts with your word processor. Is the latest version worth
the upgrade?