First, isntall MySQL package installer from

You must download the 32-bit version even if you have a 64-bit machine.

Then I was able to run this. Note: it is important to give the gem installer the -with-mysql-config flag, and point it to the file mysql_config inside the bin/ directory

sudo gem install mysql – -with-mysql-config=/usr/local/mysql/bin/mysql_config

UPDATE: Me thinks the 64-bit version now works with Snow Leopard 10.6 (haven’t tested under 10.5). But you have to set the flags to use 64-bit:

Prior to Leopard:
sudo gem install mysql – -with-mysql-dir=/usr/local/mysql

Leopard on a PPC machine:
sudo env ARCHFLAGS=”-arch ppc” gem install mysql – -with-mysql-config=/usr/local/mysql/bin/mysql_config

Leopard on an Intel machine:
sudo env ARCHFLAGS=”-arch i386″ gem install mysql – -with-mysql-config=/usr/local/mysql/bin/mysql_config

Snow Leopard (only on Intel):
sudo env ARCHFLAGS=”-arch x86_64″ gem install mysql – -with-mysql-config=/usr/local/mysql/bin/mysql_config

If you don’t run this with the right architecture RCHFLAGS, you get this when you try to launch your app:

unitialized constant MysqlCompat::MysqlRes

I had a real hard time with this one on a recent Snow Leopard upgrade, be sure to rebuild all your port installs too:

And finally do this:

cd /tmp
tar xvfz ruby-mysql-0.2.6.tar.gz
cd ruby-mysql-0.2.6
sudo ruby install.rb

By Jason

Leave a Reply

Your email address will not be published. Required fields are marked *