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.

Comments
  1. HenryNovember 02, 2007 @ 02:43 AM
    For PPC or PPC64 architectures (depending on which mysql package you got from mysql.com) modify the gem install accordingly: sudo env RC_ARCHS=ppc gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config or sudo env RC_ARCHS=ppc64 gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config Thanks for the ImageMagick tip!
  2. AlanNovember 02, 2007 @ 11:40 AM
    Thanks Henry - I haven't upgraded the G5 yet, that'll be handy!
  3. BrendonNovember 05, 2007 @ 05:01 PM
    Thanks Alan. This helped a lot.
  4. chrisNovember 08, 2007 @ 09:24 PM
    anyone know why I might be getting the following error when trying to call 'sudo port install ImageMagick':
    Error: Unable to execute port: invalid command name "destroot.violate_mtree"
    
    I am new to mac so don't even know where to start on this. thanks
  5. MattNovember 11, 2007 @ 05:47 AM
    Great job, Henry. After installing MacPorts, though, I get an error message when I continue: sudo port install tiff -macosx sudo: port: command not found Any idea what's up?
  6. AlanNovember 13, 2007 @ 12:35 PM
    Matt: try opening a new terminal window - if 'port' is not found, it's probably just an environment variable. Alternatively, try /opt/local/bin/port ... Chris: sounds like you have an out of date 'port'. Try sudo port selfupdate.
  7. DanielDecember 11, 2007 @ 09:18 PM
    Hi Alan, i recently bought your book and it's just great! But as changes in Ruby on Rails 2.0 are quite big, will the book project run with the new version? I hesitate updating my rails version....Are you working on an book update? Thanx for your answer!
  8. Stuart RobinsonJanuary 21, 2008 @ 01:12 PM
    Thanks Alan!
Post a comment