Unique Marketing, Guaranteed Results.

Tutorial: How to Set up Ruby on Rails and MySQL on Mac OSX Leopard

April 7th, 2009 by Chuck Wood

Mac OSX has become extremely popular for Ruby on Rails development. Part of this is the inclusion of Ruby as part of the operating system on Mac OSX Leopard. Here is a quick tutorial on how to get Ruby on Rails and MySQL set up on your Mac OSX Leopard machine. In order to complete this tutorial, you need the Xcode tools installed. You can get them off of the applications disk that came with your mac or from http://developer.apple.com/TOOLS/xcode/.

Once you have Xcode Tools installed, open your terminal (in Applications > Utilities) and let’s get started!

1. Update RubyGems.

sudo gem update --system

2. Install Ruby on Rails.

sudo gem install rails

3. Download the MySQL (x86) package from this page.

4. When the .dmg file loads, install both packages (.pkg files) and the MySQL.prefPane.

5. Once MySQL is installed, install the mysql gem. (Thanks wonko.com for the tip.)

sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
  --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \

That’s it! You’re ready to go! Now all you have to do is create a rails application and you’re ready to go.

Filed under: Programming,Tools,Tutorials — Tags: , , , , , — Chuck Wood @ 1:07 pm on April 7, 2009


  1. Quick and to the point. That’s the way I like tutorials. I love Macs and this is another reason to. How simple was that.

    Comment by Brandon Buttars — April 7, 2009 @ 4:24 pm

  2. Thanks Chuck, that is what all new hires need. We will have to make a list of tutorials for new hires to read.

    Comment by jaredd — April 8, 2009 @ 5:59 pm

  3. Here’s a similar tutorial with a few more steps that I found helpful: http://crypto.stanford.edu/cs142/projects/6/macRubyInstall.html

    (Interesting course materials too btw.)

    Comment by Mark Latham — May 12, 2009 @ 4:02 pm

  4. MacOS 10.6.4
    Followed installation and the last step fails.

    ERROR: Error installing mysql:
    ERROR: Failed to build gem native extension.

    Comment by Roland — June 17, 2010 @ 9:48 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Copyright © 2005-2016 PMA Media Group. All Rights Reserved &nbsp