Rails 2.2 and the Native MySQL Gem on Mac OS X Leopard

Posted on 03 November 2008 by Johannes Fahrenkrug. Tags: Mac Tutorials Ruby rails
I'm trying out the new Rails 2.2 RC1 for a new project. Rails 2.2 doesn't come with the pure Ruby MySQL client anymore, but depends on the native MySQL gem. To make a long story short, this is how to do it on an Intel Mac:
  1. Install mysql5-devel with MacPorts:
    sudo port install mysql5-devel
  2. Install the native MySQL gem like so:
    sudo bash -c "ARCHFLAGS='-arch i386' sudo gem install mysql -- --with-mysql-include=/opt/local/include/mysql5/mysql/ --with-mysql-lib=/opt/local/lib/mysql5/mysql/ --with-mysql-config=/opt/local/bin/mysql_config5"
  3. Done
This great article immensely helped me with this.

If this was useful for you, please take a minute and recommend me:
Recommend Me
Thank you!


Anonymous said...

Thank you a lot for your blog post, you helped me a lot!

December 19, 2008 12:59 PM

Johannes Fahrenkrug said...

Hi Bryan,

thank you, if that works: great!
I just read in some places that specifying the ARCHFLAGS might help as well. But the other two args really do seem obsolete if you specify with-mysql-config.

- Johannes

November 03, 2008 01:01 PM

bryanl said...

Why not just:

sudo gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5

mysql_config will give you everything else you need

November 03, 2008 12:47 PM


Please keep it clean, everybody. Comments with profanity will be deleted.

blog comments powered by Disqus