more info

Media72 Hosting Articles and Tips

Getting Real with Ruby on Rails and OS X Leopard

So Apples new operating system comes with Ruby and Rails pre-installed along with a few standard gems. It does however lack a few things you may need to get your computer running as a development machine.

In this mini tutorial we are going to cover:

Updating to the latest version of Rails
Installing MacPorts
Installing ImageMagick
Installing the Rmagik gem
Installing MySQL
Installing the MySQL gem

Firstly lets upgrade rails to the latest version of rails, open up a terminal window and enter:

sudo gem update rails --include-dependencies

Next MacPorts is a package manager for OS X and is needed to install ImageMagick, you can skip straight to the MySQL install if you do not need to manipulate images. I’m not going to explain how to install this as there is excellent instructions on the MacPorts Wiki, be sure to download MacPorts-1.5.0-10.5.dmg for Leopard.

After installing MacPorts we can get on with installing the rest of our software, fire up a terminal window and enter the following commands (enter your admin user password when requested):

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

These commands, especially installing ImageMagick, will take some time so it would be a good time to take a break. If all goes well you should now have ImageMagick and the Rmagick gem installed.

To install MySQL download the MySQL package labeled 10.4 for your architecture. Then run the mysql-5.0.45-osx10.4-architecture.pkg installer package. Next run the MySQL.prefpane file to install the preference pane.

At the current time the MySQL preference pane does not work without modification on Leopard so in the terminal enter:

sudo chmod -R 777 /usr/local/mysql/data

This gives everyone read/write/execute access to your MySQL data files, this is NOT recommend for anything other than a local development environment and is only intended as a quick fix until MySQL release and updated version for Leopard.

Finally, all we need to do now is install the MySQL gem:

For intel computers
sudo -s
ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-dir=/usr/local/mysql

For PPC computers
sudo -s
ARCHFLAGS="-arch ppc" gem install mysql -- --with-mysql-dir=/usr/local/mysql

When asked which version choose the most recent ruby version. If you have any issues getting the MySQL gem to install or run see this Mac OS Forge page.

You should now have a fully working Ruby on Rails development installation Rmagick and MySQL.

Share and Enjoy:

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Furl
  • Ma.gnolia
  • NewsVine
  • Reddit
  • bodytext
  • StumbleUpon

Leave a Reply

 

hedges