Monday, October 1, 2007

Mysql Gem on OS X 10.4

I'm starting to work with merb and I thought I'd give the sequel plugin a try.

I hoped it would be sweet but I had issues. The mysql gem needed to be installed. Apparently the AR gem has the mysql adapter coded into it and so it doesn't need the mysql gem, but I want to try sequel so I decided to get the gem installed.

By default it didn't work. The following is what I did to get it working. This is based on information I found here but it didn't work correctly for me.

According to the article at the gcc needs to be set to 3.3 I left mine at 4.0.1 and it worked fine.

First try and install the gem. This will setup the directories and get all the files.

sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
cd /usr/local/ruby/gems/1.8/gems/mysql-2.7

Edit and add the following line at the top.

#define ulong unsigned long


sudo ruby extconf.rb --with-mysql-dir=/usr/local/mysql
sudo make
sudo make install
sudo make clean

I can't promise this will work for anyone else but it worked for me.