If you don’t want to install MySQL via MacPorts for whatever reason and want a clean installation to work with Ruby on Rails and the mysql gem, you need to do this:

Go to http://dev.mysql.com/downloads/ to get the latest version of MySQL (by clicking on Download for Community Server). Download the Mac OS X package format and choose Mac OS X 10.5 (x86). Important here is to choose x86, not x86_64. The pre-installed version of Ruby on the Mac is not 64 bit so installing the 64 bit compiled MySQL will cause them to not play nice together. Install it and the StartupItem so it starts with the computer.

Then when you need to install the mysql gem (because the mysql gem won’t install correctly from scratch and throws some nasty errors), you have to give it some information on where MySQL is installed. So run this:

sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include

Many thanks to wonko.com who helped me solving this problem. I am posting it here in hopes that it might show up on google for someone else that need the problem fixed.


tetris