How to Install Ruby On Rails on Mac OS X 10.3.8
This is a brief step-by-step with commentary on installing Ruby on Rails onto a Mac OS X 10.3.8 system. If you want to install onto a Server or 10.2 system, you should be able to follow these instructions to a point, but a little poking around the linked sites may be neccessary.
First, you need a DBMS. For this, there are two major choices that run on your Mac: MySQL and PostgreSQL (RoR also supports SQLite, but I’m not going to worry about that here. It’s worth noting, though, because 10.4 is supposedly shipping with SQLite installed.) Personally, I have recently come around to the PostgreSQL camp; but for this example, I’m going to use MySQL. Because the 10 minute demo video (22 MB) uses MySQL, OS X Server ships with it installed, and, well, it’s easier to install on OS X Client that PostgreSQL. Full instructions for installing MySQL can be gotten from Mark Liyanage (he also has nice setup instructions for PostgreSQL)
Optionally, you can get a nice manager for your DBMS. For MySQL there is phpMyAdmin and CocoaMySQL. For PostgreSQL there’s phpPgAdmin. I’m using CocoaMySQL at the moment, it’s very nice. It’s also the tool used in the 10 minute demo.
Upgrade Ruby. Mac OS X 10.3.8 includes Ruby 1.6.8, Rails requires version 1.8. Here’s some sufficiently pedantic upgrade instructions.
- Get the Ruby 1.8.2 Disk Image from the Ruby stuff for Macs page (I love that title).
- Mount it.
- Double click the ‘Ruby.mpkg’ installer package.
- Do the install.
- Unmount the disk image.
- Hack your PATH. Ruby is installed in
/usr/local/*/so as to leave the Apple-installed version alone. Thus, we need to set our PATH to look there first. AddPATH=/usr/local/bin:/usr/local/sbin:$PATHto a file named.tcshrcin your home directory for tcsh. For bash, add it to.bashrcin your home directory.
Install RubyGems. You don’t have to to this. You can happily do Rails stuff starting with just the tarball off the website, but the Gems system is nicer. (Full instructions can be found on the RubyGems Wiki.)
- Get the tarball from the RubyGems RubyForge page.
- expand it
- cd into the extracted directory
- Run
sudo ruby setup.rb
Install Rake. Rake is the Ruby Make-style tool. It’s handy.
- Run
sudo gem install rake
- Run
Install Rails. The point of this exercise.
- Run
sudo gem install rails(I told you RubyGems was nice.)
- Run
Optional PostgreSQL support. If you want to use PostgreSQL. Note that with the entropy.ch package gem will fail during the install. These instructions will fix that.
- Run
sudo gem install postgres - It will copy the gem to your system and fail on install.
cd /usr/local/lib/ruby/gems/1.8/gems/postgres-0.7.1/(Your version numbers may differ, poke around.)sudo ruby extconf.rb --with-pgsql-lib-dir=/usr/local/pgsql/lib/ --with-pgsql-include-dir=/usr/local/pgsql/include/sudo makesudo make install
- Run
To start a new Rails app, just create a new directory, cd into it and run ‘rails .’. You should be able to do the wonderful Todo Tutorial now.
