Snow Leopard, Fink, and Ruby

Here’s some tips based on my experience trying to get all my fink packages updated and all my gems working again under Snow Leopard. I use /usr/bin/ruby, that is, the Ruby that comes with Snow Leopard, since Apple has (mostly) gotten it right as of Leopard. I also use fink to install my Unixy stuff, unlike every other Rubyist I know who all use MacPorts. These facts conspired to lead me down a previously untrodden path—bring the machete, it’s a thick jungle.

Update: I’ve successfully built the mysql gem against MySQL installed via a 64-bit fink as described below. Here’s the incantation I used:

$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- \
    --with-mysql-dir=/sw64

Updating Fink

Since I was upgrading from Leopard, I already had a 32-bit install in /sw. Following the upgrade instructions made what I already had work again. Updating my installed packages was another matter. Here’s the issues I ran into on a fink update-all, and how I solved them:

  1. pango1-xft2-ft219 ran into some issues with missing .la files. The fix suggested on the fink-users list worked for me, although I can’t guarantee it won’t break something later.

  2. boost1.35.nopython passes -Wno-long-double to GCC. The version of GCC in Snow Leopard doesn’t have that flag, and errors out if you try to use it. I fixed it by copying fink’s package info (boost1.35.info and boost1.35.patch) to the local/main package tree (/sw/fink/dists/local/main/finkinfo/), and fixing the patch to remove the -Wno-long-double option.

    The result is available on bitbucket. Just copy 32bit/boost1.35.* into the aforementioned local/main package tree on your fink install, run fink index, and then fink install boost1.35-nopython.

Installing a 64-bit Fink

Next up was getting my gems, in particular RMagick, working with Snow Leopard’s shiny new 64-bit Ruby. Since it’s 64-bit, you can’t build gems against your 32-bit libraries installed through fink. But no matter—it turns out to be possible (even relatively easy) to set up two fink installs, one 32-bit and one 64-bit. Here’s how to do it:

  1. Follow the instructions from the fink website to bootstrap a 64-bit install into /sw64, leaving the existing 32-bit install alone.

  2. Skip adding . /sw64/bin/init.sh to your login scripts, leaving the 32-bit install as the default. Instead, when you want to use the 64-bit version, execute that line from the terminal. Now just that terminal window will default to 64-bit fink.

Once I’d done the above, it was just a matter of running fink install imagemagick, and then sudo gem install RMagick… oh, but wait, no.

See, RMagick is picky about the configure options you use to build ImageMagick; it doesn’t work with HDRI support enabled (whatever that is). Fink’s imagemagick package has it enabled by default, so I again took to customizing the Fink package info and putting it in the local/main repository (in this case at /sw64/fink/dists/local/main/finkinfo/), changing --enable-hdri to --disable-hdri. Once again, the result is available on bitbucket in 64bit/imagemagick*.

So once I’d finished that, I ran fink index and fink install imagemagick again, and the RMagick gem installed fine. Yay!

My next endeavor will be to try to install a 64-bit MySQL thru fink, but for now I’ve handled that by installing the MySQL 5.1 package from mysql.com.

Also note: I haven’t tested any X11 apps under fink64 yet. Not installing the fink64 xinitrc might break things horribly.


About this entry