Installing MySQL Gem on Leopard with MacPorts Mysql

The MySQL Gem won’t install directly on a Leopard machine using a Macports install of mysql (or any other MySQL install method I can think of) because by default gem will try built a universal gem, however the MySQL install will only have libraries for your current platform. So we need to force the architecture the gem is built for.

To install on a Intel Machine:

1
sudo bash -c "ARCHFLAGS='-arch i386' gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5"

To install on a PowerPC Machine:

1
sudo bash -c "ARCHFLAGS='-arch i386' gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5"

Make sure you select the newest ruby (not mswin32) version.
If you are not using a Macports MySQL Install, find where mysql_config lives and update the above command.

More info on the bundled Ruby under Leopard can be found here: http://trac.macosforge.org/projects/ruby/wiki/WhatsNewInLeopard

2 Comments so far

  1. Oscar Del Ben on August 12th, 2008

    Finally, this worked for me, thanks

  2. SK on August 25th, 2008

    Awesome, finally got this gem to install. Thanks a lot!

Leave a reply