Safe and Happy UNIX Hacking with MacOS X
As I mentioned before, MacOS X version 10.1 lacks package management system similar to RPM or Debian APT which tracks system components in central search-able database (may be 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.
All described here would not possible without great work of talented programmers - Christoph Pfisterer, Max Horn and all others, who developed port of the package management system from Debian/GNU Linux (one of the most powerful and advanced this days) for MacOS X. This port is called Fink. Also, I would like to thank Marc Liyanage who helped me with initial adoption of MySQL.
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 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 (UNIX directory tree in brief described
Fink, as well as all UNIX software properly packaged with Fink (except Darwin/MacOS X version 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 do not tracks MacOS X native components, only software installed with Fink itself !
Installing Fink is quite simple. Since Fink is a quickly evolving software, and you may use different version from main, installation procedure might be different, too. Fink distribution supplied with excellent manual, so just look into it. For version 0.3, launch Fink installer, wait until it finishes, then create text file named ".cshrc" (beginning with dot ".") containing line "source /sw/bin/init.csh" in your home directory Users -> Your Name (run "echo "source /sw/bin/init.csh" > .cshrc"), and 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 Fink core in auto-pilot mode to the next release. You should not use 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". In order to upgrade to cutting edge release use technique described below.
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 list of available Fink packages. To install (or upgrade) already precompiled Fink-enabled packages I may advice 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.
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 Benefits
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.
Full and comprehensive instruction available at Fink Web site, however, it assumes that you are an 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"). You can download original and modified package description *.info files here.
Fink is being developed very actively, and the last packaged binary release may not be actually up to date. In this case you can install packaged release and then upgrade it to the cutting edge CVS version. In order to upgrade Fink core to CVS version run the following commands: "mkdir fink-cvs" (this will create temporary directory for Fink sources to be downloaded from CVS), "cd fink-cvs", "cvs -d:pserver:email@example.com:/cvsroot/fink login" (you will be asked for password, just press Enter), "cvs -z3 -d:pserver:firstname.lastname@example.org:/cvsroot/fink co fink" (it will take some time to download required files), "cd fink", "./inject.pl". You can remove temporary directory with "rm -R fink-cvs" or leave it for future updates from CVS. To update existing local Fink CVS sources run "cd fink-cvs/fink", "cvs -z3 update -d" and then "./inject.pl" to update Fink itself.
After you have upgraded Fink it is time to get
catalog of packages available from CVS. Run "mkdir
(you will be asked for password, just press Enter), "cvs
-z3 -d:pserver:email@example.com:/cvsroot/fink co packages",
The only remaining step is to build and install packages - "fink
Q. What to do if one want to rebuild an existing
Fink package but with different compilation options?
Q. How to tinker with stuff from the unstable
tree (beta, testing, experimental, etc.)?
Q. The package I am looking for seem to be not
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 !!!
Q. The "apt-get
install package-name" fails to install known
package (error message - package not found). What to do?
Q. I have a problem with Fink and could not figure
out how to solve it.
MySQL deb for MacOS X is available for download here.