Cowell Computer Consulting

Installing produCtion based mysql gem on OS X

The default mysql database adapter that ships with OS X is not optimized for produCtion use (read: not written in C).

Installing this gem on OS X can be a bit tricky because mysql isn't where the gem installer expects it to be. You attempt to install the gem and the compile fails because it can't find libraries etc. If you've installed mysql via the installer available on mysql's website (vs. ports) these instructions should work for you.

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-include=/usr/local/mysql/include/ --with-mysql-lib=/usr/local/mysql/lib/ --with-mysql-config=/usr/local/mysql/bin/mysql_config

I was doing some heavy data crunching and switching to the production gem has definitely decreased cpu usage.

I should also credit this site: http://weblog.imapenguin.com/articles/2006/02/01/mac-os-x-10-4-ruby-mysql-adaptor

I'm not sure if this is where this originated.

Posted by Luke Cowell on June 28, 2008 at 07:01 AM