Failed Attempt to Install Gentoo for Mac OS X

Gentoo for Mac OS X Since the announcement of Gentoo for Mac Os X, I have been eagerly wanting to give it a try. Portage is such a great package management system that it allows you to customise the features at compilation time using the USE variable. I am using it for my own Linux server and all our development boxes at work. I would love to use it on my iBook as well.

So last Friday I downloaded the .dmg file that contains the bootstrapping image and gave it a go. The result is... disastrous! I ended up being locked out from logging in, and had to re-install Panther, all the patches and DarwinPorts afterwards. Here's my story.

Installation

So, I followed the instruction inside the Readme file after I mounted the gentoo-macos.dmg, and tried to bootstrap Gentoo for Mac OS as root user. I then do an emerge sync to make sure that I have all the latest ebuilds. However, when I tried to emerge system, a few packages returned with errors saying that they are masked for installation due to keyword issues. It sometimes happens when the packages you want to install is not yet supporting your platform.

If you actually grep through the .ebuild files inside the Gentoo portage tree, there are only very few packages that have "macos" declared inside the KEYWORDS variable. Even for some essential system packages (i.e. those required for emerge system), "macos" is still not yet part of supported platforms. Portage would refuse to emerge them if you try. So, there are two solutions:

  1. Add "macos" into "KEYWORDS" for every package that you would like to emerge but portage refuses to. It turns out to be a tedious task as majority of the packages do not yet have Mac OS X support in the .ebuilds.
  2. Change "ACCEPT_KEYWORDS" to "ppc" to trick portage to think that it is actually compiling for PowerPC version of Linux. That instantly turns a lot of packages into "ready-to-compile" state.

Being a lazy bum, I opted for option 2. Still, Darwin is no Linux even when it pretends to be. As the Mac OS X's user-land is more BSD'ish, only a few packages can be compiled with unmodified Gentoo .ebuild. If emerge process bumps out at the compilation time, I was just too lazy to track down the error to have them fixed. In comparison, Fink and DarwinPorts have many more applications ported to Mac OS X.

Binary installation wise, unlike Fink who installs under /sw (what IMHO is also a stupid idea) and DarwinPorts copies to /opt/local, portage installs the binaries directly into /usr! It mixes the executable and shared libraries with those that comes with Mac OS X from Apple, which provides no easy way for uninstallation except through portage. On DarwinPorts, I can simply delete the whole /opt/local directory and build it from scratch again if I really stuffed up. It would be a pain to do that under Gentoo for Mac OS X.

Another issue with mixed binaries is that you can easily overwrite Apple's executables with the ones you compiled with Gentoo. And I think I was bitten by it.

Later that night my wife wanted to use the iBook, however she found that she could not perform a quick user switch. I then tried to log my session out to bring the Mac back to its login screen, only found out that there was nothing but Spinning Beach-ball of Death waiting for us. I powered it down, and it refused to boot back up. Oh great, I just stuffed up my iBook.

I suspect that Gentoo must have replaced some files that rendered the iBook unbootable, even though I did not figure out where the offending files are. At the end, I have to boot off from the Panther CD and re-install the OS again. Lucky that it spotted my previous installation, and then migrated all my home directories, 3rd party applications and personal settings over smoothly. Meanwhile, I will stay away from Gentoo for Mac OS X for a little while, and stick with DarwinPorts as it is a proven mature product.

Verdict

Gentoo is great, but not yet on Mac OS X. I will keep an eye on it, and hopefully soon it would be as usable as Gentoo on Linux. I might give it another try in a few months of time to see whether the collection of packages have improved.

There is also an alliance between Fink, DarwinPorts and Gentoo, called Metapkg, which aims to bring more applications to the Mac OS X platform. Mac OS X is now not just Mach kernel, BSD sub-system and Apple GUI, but one of the favourite platforms for open source software development.