Mysql, OSX Leopard and Ruby

My MacBook had a blowout the other day. Sent it to Apple and they had to replace the hard drive. That said, I’ve spent most of the day reinstalling everything. I tried to use the ruby that comes with OSX, but was having too many issues so I went with a basic install from source.

The problem I had was when I tried to MySQL working. I installed MySQL via the 64-bit .pkg they have on their site. That took fine. The issue was installing the mysql ruby gem. I kept getting errors from extconf.rb about missing headers, etc. After an hour of googling and trying everything from an OSX Ports install and compiling against the 32-bit MySQL files, I finally got it.

The golden combo in the end was to install MySQL from source (mysql-5.1.33-osx10.5-x86_64.tar) but then don’t try to use the gem command to install the mysql gem. Instead, I grabbed the latest source version of the gem here and simply followed the install instructions

% ruby ./setup.rb
% ruby ./test.rb localhost root
# ruby ./install.rb

And it works!
Hopefully this helps someone else. I know I’ll probably forget and need this in a year or less…

1 comment so far

Wow, my notebook hard drive also blew up today and I had to reinstall everything from scratch… I couldn’t get the mysql gem working with the latest version of mysql but your suggestion did the trick.

Thanks a lot! You did in fact help someone!

Pierre Olivier
April 17th, 2009 at 2:38 pm

Leave a Reply

Name

Mail (will not be published)

Website