Installing the MySQL Gem on OS X 10.6 (Snow Leopard) with MacPorts MySQL5

March 02, 2010

This one took me longer to figure out than I'd like to admit. If you're running Snow Leopard with MySQL installed via MacPorts, here's the incantation you need to install the MySQL gem:

sudo port install mysql5-server
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5

The key details: you need to force the x86_64 architecture flag, and you need to point the gem build at MacPorts' mysql_config5 rather than the default mysql_config path. Hopefully this saves someone else the half hour I spent on it.

Questions or thoughts? Get in touch.