I recently purchased a MacBook to use as my primary development system. One of my first plans was to get up and running with Rails on this new machine. Given that Leopard (OS X 10.5) comes with Ruby version 1.8.6 and RubyGems 1.0.1, I thought I would be in good shape, but there were a couple of snags. Thanks to the power of Google and other people with similar problems, I was able to get it sorted out. Here’s what I did:
- Updated rubygems to 1.1.1 with
sudo gem update –system
- Installed the 32-bit (x86, NOT x86_64) version of MySQL (community edition, of course) via the installer on the MySQL download page.
- Installed the native MySQL driver for Ruby (this was tricky, see below)
- Finished by installing Rails and its friends via
gem install rails
sudo env ARCHFLAGS=”-arch i386”If you’ve never seen it before, the ‘–’ after ‘gem install mysql’ means that gem should pass along the next arguments to the programs it uses to build the driver.
gem install mysql –
The reason for installing the 32-bit version of MySQL (on your fancy 64-bit OS and machine!) is that the version of Ruby that ships with Leopard is apparently 32-bit only. Yikes.
I’ve noticed several little annoying details like this in getting other things to work “like I like” on OS X. I’ll probably end up posting more about them in the next couple of posts.
I know that “how to” posts of the form “I wanted to do X, but Y happened. Finally I fixed it by Z,” are pretty boring. Still, I hope they are useful for preserving the knowledge of how to work around these problems, both for myself and for others.