Rails, MySQL and ImageMagick on OS X Leopard

Posted on October 29, 2007

Just a note to myself for getting my other machines Rails environments up and running properly. Basically a collection of info from the Rails Weblog Angry Fly and NullStyle

Thanks guys!

Rails 1.2.3 comes pre-installed on Leopard. To get the rest of the environment up:

Update gems

sudo gem update

Install MySQL package

From the usual place

Install the Ruby MySQL bindings

sudo env RC_ARCHS=i386 gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Update: If you’re on PowerPC, instead of the above, use one of the following commands (depending if you’re 32 or 64bi). Thanks to Henry for the tip in the comments!

sudo env RC_ARCHS=ppc gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

sudo env RC_ARCHS=ppc64 gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config 

Fix MySQL for Leopard

cd /usr/local/mysql/lib
sudo mkdir mysql 
cd mysql 
sudo ln -s /usr/local/mysql/lib/lib* .
Start MySQL with: (the sys prefs box doesn’t work yet)
sudo /usr/local/mysql/bin/safe_mysqld
Now make a link to the MySQL socket
sudo mkdir /var/mysql/
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Install MacPorts

From here

Install ImageMagick + RMagick

sudo port install tiff -macosx
sudo port install ImageMagick
sudo gem install rmagick

I think that hits the main things that tripped me up. I’ll update if anything else crops up.