Falling Leaves: the Ardes blog

Monthly archives for "January 2010"

Snow Leopard Developer Upgrade Notes

Ray Drainville

Apple’s latest release of OS X is version 10.6, or “Snow Leopard”. For most users, upgrading isn’t a worry: you upgrade, and everything just works. Developers, however, will find that upgrading is more haphazard, as the environment has switched from 32-bit to 64-bit. Plus, you have to find enough downtime in which to upgrade & deal with any issues that arise. For me, that downtime finally occurred over the Christmas/New Year’s holiday period. In a hazy, and admittedly alcohol-induced moment, I rashly decided to install 10.6 around midnight a couple of days ago, forgetting that I hadn’t fully thought out what to do with all the Rails apps I had on my machine.

So here are some notes for when/if you want to take the plunge to 10.6 (which I recommend that you do). Matt Aimonetti’s August 2009 article on the Riding Rails blog contains very good general information. What I took away from it is that Snow Leopard requires 64-bit versions of your Unixy software: remaining 32-bit isn’t an option, as I’d hoped (from a position of laziness, that is, prone). So you’ll need to recompile not just all your MacPorts goodies, but of equal importance, all your gems.

Matt suggests that upgrading ain’t that bad. In my experience: lies, all lies. Virtually nothing he or the commenters suggested worked for me, so like some crazed frontiersman, I had to forge my own path. I blew everything away & started afresh. Here’s what I did:

  • Before anything: export your databases (or at least have their contents close to hand in some fashion);
  • Start your MacPorts dance, installing/upgrading to the latest MacPorts & then installing all the software you need;
  • I had a lot of trouble updating MySQL. The tips in this article did me a real treat when nothing else worked;
  • A little titbit of info: apparently you can have problems with the MySQL gem, as apparently it wants to compile as 32-bit. You’ll have to force it to compile as 64-bit:
    sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-include=/opt/local/include/mysql5 --with-mysql-lib=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
  • Re-create your databases & use your db exports to populate them;
  • For Rails apps that have gems in vendor/gems (thanks to Ian for this), you’ll need to recompile them for 64-bit:
    rm -rf vendor/gems/* ; sudo rake gems:install ; rake gems:unpack ; rake gems:build
  • For Rails apps that don’t have gems in vendor/gems (boo! hiss!), the situation is more hit & miss. The easiest option is to just install new versions of all your old gems. However, I wanted to take this as an opportunity to prune through the thicket, hence my slight pain. If you follow my lead here, just try to run your app & see what gem is missing: then install it.

The end result: when the sites popped up, I was stunned by how quickly they appeared. In addition, the whole compiling MacPorts apps was shockingly quick.