Ruby on Rails & MySQL on Tiger

First, see the previous blog entry to fix your Ruby install to be able to make proper binary extensions. You're going to need to build a mysql extension for Ruby later.

If you haven't already done so, install XCode (it's on the Tiger DVD), and fink. If you've only just installed fink, make sure you do a

fink selfupdate
fink update-all

Those will take a considerable amount of time if you haven't run them before.

Now you need to install MySQL. You can either do it from the bare tarball, or use a package manager like fink or darwinports. I like fink, so do:

fink install mysql mysql-client

and let fink grind away at all the assorted dependencies mysql needs. This will take a while, MySQL is big.

Now that MySQL is installed, we can install rails -

sudo gem install rails

Rails doesn't ship with an adapter for MySQL. We install it like so (this should be one line)

sudo gem install mysql -- --with-mysql-lib=/sw/lib/mysql --with-mysql-include=/sw/include

so that it can find the mysql libraries fink installed earlier. Note that the -- --with-mysql-include is supposed to be there, that isn't a typo.

You can now go find one of the Rails tutorials like the one Vincent Foley has at http://darkhost.mine.nu:81/~vince/rails/tutorial.html and get started with Rails.

No comments:

Creative Commons License

This work is licensed under a Creative Commons License.
Copyright 2007-2010, Joseph P. Block, Some Rights Reserved.

Creative Commons Logo