Friday, April 09, 2010

Installing MySQL for Rails on Snow Leopard

Download the 64-bit .DMG version of MySQL Community Server. Note that the .DMG package installs the MySQL directory at /usr/local/mysql so it will help to add /usr/local/mysql/bin to your path.

Install the mysql gem with the following commands:

  1. export ARCHFLAGS="-arch x86_64"
  2. gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config

According to this forum post, using version 2.7 (instead of the latest) of the mysql gem will make it work. However, I find that version 2.8.1 works fine.