How to get MySQL, Ruby, RVM and Rails working on Snow Leopard

January 2011

For over a year now I refused to upgrade from Leopard to Snow Leopard on Mac OSX. I knew it wouldn’t be a simple straight forward procedure.

So this past Christmas, when I had some time to spare, I took the plunge and of course, as expected, not everything worked after.

It took me a few days to get everything back up and running so I’ve noted down some things below to help any other designers/developers who have still to make the jump.

Backup your development databases

Should go without saying but here’s your reminder anyway. Backup everything.

Specifically, back up your local databases. For handiness, backup/copy your MySQL databases (located under /usr/local/mysql/data) to your desktop. You’ll want to use these shortly after upgrading.

Sidenote: How to open /usr/ in Finder

I’m usually lost when it comes to working in Terminal. I prefer to see folders in Finder.

In case you didn’t know how to locate and open any hidden folders like /usr/ do the following:

  1. Open Terminal.app
  2. Type: cd /usr/
  3. Type: open .

Simple when you know how.

Install/Upgrade to Snow Leopard

Follow the on screen instructions. Should be simple enough and takes a little less than 1 hour.

Install MySQL

Go to MySQL.com and download the latest version of MySQL.

Just to confuse you there are a few options. Go for the DMG Archive. You’re most likely looking for the 64-bit but check first to make sure.

Once downloaded, install MySQL (along with the Startup Item and Preference Pane).

Restore your development databases

At this point we have MySQL installed but we don’t have any data.

You want to copy the data folder that we previously backed up into your new MySQL folder.

I found this link helpful from Corey. Restore development databases after Snow Leopard upgrade.

In short:

  1. Turn off MySQL (use the Preference Pane)
  2. Replace /usr/local/mysql/data with your backed up data folder
  3. Turn on MySQL

MySQL is nearly all set

At this point I tried one of my PHP sites locally however it didn’t work.

Thanks to Aaron’s solution here, I was able to get it up and running.

  1. Open Terminal.app
  2. Type: sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /usr/local/mysql/support-files/mysql.server
  3. Find the line starting with basedir and datadir and replace with:
    basedir=/usr/local/mysql
    datadir=/usr/local/mysql/data
  4. Save the file
  5. Start MySQL using the System Preferences pane button.

Installing Ruby, rvm and Rails

This is where I got completely lost and wasted a couple of days trying to troubleshoot and get things up and running.

I installed rvm, ruby and the rails gem but couldn’t get any local applications to run for one reason or another (usually some sort of gem problem).

In the end I had to give in and ask for help from the talented Mr David Rice, whose conclusion was to do a clean install.

  1. Remove RVM
  2. Remove Ruby
  3. Install Xcode if you haven't already done so (p.s. it's a big ass file)
  4. Install git, RVM, Ruby and Rails

Hopefully this is you up and running.

Should it be this difficult?

I’m not a developer so I was lost quite a bit along the way. Running commands in Terminal is a task in itself.

It seems to be different for everyone so the process above might not be exactly the same for you. And if you’re a developer you might be saying to yourself “Why did he need to do that?”. Tell me if anything above looks odd.

If someone can create a button that once clicked, installs everything you need (in all the right places) to get a Rails project running locally, that would be great thanks.

Big thanks to David Rice for his help and to all the websites mentioned above. Stackoverflow is your friend in situations like this.

Receive more design content like this to your inbox

I promise not to spam you. No more than one email per week.

I blog and share links about web design, user experience, product development, HTML/CSS, email design and anything else I find interesting.

No thanks