Now that Apple has released their new OS, Snow Leopard, thousands of devoted Mac web developers are jumping on the upgrade bandwagon - and for good reason! Snow Leopard has implemented a ton of nice little tweaks to make your Mac faster and more reliable, resulting in a much smoother development environment.
One of the biggest changes in Snow Leopard is the shift to 64-bit computing. While this change will make for huge speed increases and optimized memory usage, it also means that you'll need to upgrade or re-compile any 32-bit applications or libraries still lingering around (that is, if you installed Snow Leopard on top of your existing system rather than doing a clean install).
So to make your lives easier, I've put together a list of all the steps that I had to take to get back down to business. These instructions should work for most Mac/Rails setups, though you may need to tweak certain steps or take a few more should errors arise.
1. Prep Your Mac & Install Snow Leopard
Lifehacker put together a pretty solid guide to cleaning up your OS X 10.5 Leopard installation, backing it up in case of errors, and finally installing Snow Leopard: Prep Your Mac for Snow Leopard. Installation took about an hour to complete on my MacBook Pro.
2. Upgrade Xcode with the Snow Leopard Optional Install
Don't pop that install disc out just yet, next we need to install the enhanced version of Xcode developer tools. The Xcode installer can be found in the Optional Installs folder and the default settings should do just fine.
3. Restore Apache configurations from your 10.5 Leopard backup
It's likely that your custom Apache configurations were wiped out during the upgrade, but luckily you read through Step 1 and have a nice lil' backup of your 10.5 install. I only needed to restore my Virtual Hosts file, but I've seen others report that they needed to restore httpd.conf, as well.
4. Upgrade to 64-bit MySQL
Hivelogic has come to the rescue and provided a great tutorial on Compiling MySQL for Snow Leopard. It worked great for me, however I had to run the gem install with a specified C extension to force 64-bit compilation:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
A quick note about /usr/local
If you've been running with the default Leopard Ruby install, you won't need to worry about installing Ruby, as Snow Leopard comes bundled with 64-bit Ruby 1.8.7.
However, if you know about the benefits of manually compiling your libraries in /usr/local (no? see here and here), you'll need to upgrade Ruby manually.
In either case, this article from the RidingRails blog should provide additional insight and more helpful hints: Upgrading to Snow Leopard.
5. Upgrade to 64-bit Ruby
Once again, Hivelogic comes through with their Compiling Ruby, RubyGems, and Rails on Snow Leopard tutorial.
6. Upgrade remaining 32-bit gems
The RidingRails blog provided a nice script to look through your installed gems and list out any compiled gems that need to be upgraded for 64-bit.
If you've manually compiled Ruby in /usr/local, you'll need to alter the script to point to the appropriate gem path by changing the following line:
# Dir.glob('/Library/Ruby/Gems/**/*.bundle').map do |path| Dir.glob('/usr/local/lib/ruby/gems/**/*.bundle').map do |path|
Once you've generated the list of upgradable gems, you'll need to reinstall them. Simply updating may not rebuild the library, so you'll need to uninstall and then reinstall. There also seems to be some confusion on whether or not forcing the C extension to compile for 64-bit is necessary in Snow Leopard, but it doesn't seem to hurt. To do so, run your gem install command like so:
sudo env ARCHFLAGS="-arch x86_64" gem install hpricot mongrel xmlparser
For more information on rebuilding your gems, check out this post from Victor Costan's blog. He also suggests running:
sudo gem update --system; sudo gem pristine --all
7. Upgrade remaining 32-bit libraries
This is where the fun begins. I'd suggest taking a peak into your /usr/local and /usr/local/lib folders to get an idea of what other libraries might still need updating. A few of the bigger ones for me include Git, Sphinx and RMagick.
Compiling Git
And another Hivelogic tutorial for the win: Compiling Git on Snow Leopard. You may need to upgrade some dependent libraries before building git will work (in my case, I needed libiconv).
Compiling Sphinx
iCoreTech put together a quick tutorial on getting Sphinx compiled for 64-bit - be sure to pay attention to the custom 64-bit configuration flags. My configuration looked like:
LDFLAGS="-arch x86_64" ./configure --prefix=/usr/local --with-mysql=/usr/local/mysql
Compiling ImageMagick and installing the RMagick gem
I've compiled a shell script to install the necessary dependencies, ImageMagick and the RMagick gem. It's an updated compilation of Agile Animal's and iCoreTech's scripts.
The updated script can be found at: http://pastie.org/620711. Simply save it as a .sh file and run it from the command line, like so: sh install_magick.sh
A Few Additional Notes and Resources
Hopefully this has gotten you through the bulk of upgrades needed to get back to work! But if not, here are a few other helpful resources that might help you out:
- Snow Leopard Ruby/Rails Developer Setup
- Fixing Ruby Gems, MySQL, and Passenger Phusion on Snow Leopard
- Install Passenger (mod_rails) in Snow Leopard 64-bit





September 17th, 2009 at 1:27 pm
Great resource. However, the ftp link for ImageMagick is wrong. The ImageMagick file should read:
ImageMagick-6.5.6-1.tar.gz
instead of ImageMagick-6.5.5-6.tar.gz
Thanks again, works great.
September 17th, 2009 at 1:39 pm
Thanks, Jerome! Glad we could help you out :)
And thanks for the tip on the ImageMagick URL - I’ve set up a new Pastie and updated the link in the post.
September 24th, 2009 at 9:40 am
[...] Upgrading Your Rails Development Environment for Snow Leopard [...]
October 28th, 2009 at 1:03 pm
Hi Julie. Thanks for the great information here. Since Dan Benjamin doesn’t have his comments enabled on the post about installing Ruby in /usr/local, I thought I’d inquire with you. I’ve gone back to using the default Ruby for now but when I tried “make”, I got some errors compiling readline. Do you know what that’s about? Thanks again.
October 28th, 2009 at 1:13 pm
@Doug Hmmm, not sure what the problem could be offhand, but if you post the error message and any other special notes on your installation, I might be able to help you out
October 28th, 2009 at 1:18 pm
Ok, so I just found a solution. I just compiled it by itself first:
cd ruby-1.8.7-p72/ext/readline/
ruby extconf.rb
sudo make
sudo make install
and then I was able to install Ruby in /usr/local. Why? I’m not sure.
October 28th, 2009 at 1:25 pm
@Doug, glad to hear you got it worked out!
November 2nd, 2009 at 3:43 am
Hi,
I installed ImageMagick with this script here because it seemed the most up to date one and I had trouble with the Mac Ports installation: http://github.com/masterkain/ImageMagick-sl
I get the following error in some ImageMagick commands:
Magick::ImageMagickError: Wrong JPEG library version: library is 70, caller expects 62 `’ @ jpeg.c/EmitMessage/232
Can anybody advice? What do I need to do?
November 2nd, 2009 at 7:11 am
Its fixed now. There was an older version of the jpeg lib from Mac Ports which needed to be removed before running the Image Magick install script.
January 10th, 2010 at 12:40 am
I’ve been considering this recently, and I think it’s one of those things that more people will be commenting on. We can’t plan to get anywhere if we merely keep our brains stuck in the sand.
February 26th, 2010 at 10:37 am
OMG, I have been searching for this information. Technology always gets the best of me when I need it most.