The MySQL ruby gem on Leopard (client)
I just started getting back into Ruby on Rails, after a hiatus while I battled with Leopard server. I discovered that setting up my Rails development environment in Leopard wasn’t as perfectly straightforward as it was in Tiger.
I installed the binary distribution of MySQL, and proceeded to install the mysql ruby gem to connect to it. First, the build failed because it didn’t know where to look for the mysql client libraries, then it failed again because by default the Makefile tries building for both PPC and Intel architectures.
To make a long story short, the solution is to add an ARCHFLAGS environment variable specifiying your architecture, and to provide the path to mysql_config on the command line. For the former, add:
ARCHFLAGS="-arch i386"
To your /etc/bashrc (assuming you use the default shell, bash), and open a new terminal or run ‘bash’. If you’re on PPC architecture, change “i386″ to “ppc”. Then try the gem again with the path to mysql_config appended, like so:
sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
That is all on one line.

June 29th, 2008 at 15:47
YES this worked for me, under what sound like identical circumstances. Thank you!
March 15th, 2009 at 22:22
Very nice information. Thanks for this.
March 21st, 2009 at 17:06
This is the only information that worked for me after trying about 15-20 different ways.
Thanks a million!!
I’m digging so I never have to search for this info again
Cheers,
Joshua
http://iSEOapp.com – Keyword density for your iPhone/iPod Touch
November 20th, 2009 at 21:20
Had a weird experience installing mysql ruby gem on Solaris 10, on an amd64 box. The problem turned out to be that some wise person hard-coded the path to the ‘cc’ binary into the ruby gem Makefile:
CC = /opt/studio/SOS11/SUNWspro/bin/cc
Nice one.