Installing Ruby On Rails on Mac OS X Tiger 10.4
28 Feb 2006: I wrote this article seven months ago and, at the time, it was current and wonderful and I was a happy Rails tinkerer. In the intervening months, outside forces have moved me into the world of professional CakePHP programming (don’t worry about me though, Cake is basically PHP on Rails). Thus, this page has become outdated and crufty. However, it still gets a decent amount of Google- and deli.cio.us-directed traffic. So, I’m adding this short note to point you weary travelers to Dan Benjamin’s article on getting RoR up and running on OS X with all the bells and whistles.
In short: Don’t bother with this page, go read Dan’s HiveLogic article or the Apple Developer Connection article. You’ll be glad you did.
Since I wrote up the somewhat convoluted process of getting Rails set up on Panther, it seems only fair that I document the process of getting it running on Tiger. Turns out, it’s a lot simpler.
Firstly, the big changes: Ruby 1.8.2 and a DBMS are already on your system. With Tiger, Apple has upgraded the pre-installed Ruby to 1.8.2 so we don’t have to do anything there. Likewise, Apple includes SQLite in every Tiger install, so I’ll base this around using that as a back-end rather than MySQL or PostgreSQL. (The command line client for SQLite is sqlite3, by the way.)
And now, the install process:
- Install the Developer Tools. You’ve probably already done this, if not, the installer is on your Tiger DVD.
- Tweak Ruby. The pre-installed version of Ruby is almost perfect. But it needs a couple little fixes. If you want to know what’s up, the details are here. We also add a symbolic link so that ruby can be accessed via
/usr/local/bin/ruby, which is where Rails expects it.- Slip into Terminal.
curl -O http://users.tpg.com.au/aarnold/rbconfig.rbless ./rbconfig.rb, this will display the file in the terminal. It should contain lots of stuff like ‘RUBY’ and ‘CONFIG’ and absolutely nothing like ‘<html>’ or ‘404 Error’. Type aqto exit less.sudo cp ./rbconfig.rb /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rband enter your login password when prompted.sudo ln -s `which ruby` /usr/local/bin/ruby
- Install RubyGems. RubyGems is by far the easiest way to install Rails.
curl -O http://rubyforge.org/frs/download.php/3700/rubygems-0.8.10.tgztar -xzf rubygems-0.8.10.tgzcd rubygems-0.8.10sudo ruby setup.rb
- Install the SQLite3 Adapter for Ruby. This will allow Ruby to access SQLite databases.
sudo gem install sqlite3-ruby- Select option 1:
sqlite3-ruby 1.1.0 (ruby).
- Install Rails. Yes, it really is a lot simpler on Tiger.
sudo gem install railsand answer Yes to install all the dependencies.
That’s it, Rails is installed. Now, to make sure everything is working, let’s get the To-Do List tutorial setup. We’ll use the WEBrick server included as part of the Rails project.
- Create the Project. This is where the To-Do list application lives.
- Slip into Terminal.
mkdir todocd todorails .
- Create the Database.
- Again, in Terminal, in the
tododirectory. sqlite3 db/dev.db- You should now be at an
sqlite>prompt. CREATE TABLE todos ( id INTEGER PRIMARY KEY, description VARCHAR(100) NOT NULL, done TINYINT DEFAULT 0 NOT NULL );.quit
- Again, in Terminal, in the
- Point Rails at the Database.
- Edit the file
todo/config/database.yml - Change the ‘development’ entry so it looks like this (note that
development:is not indented and the second and third lines are indented two spaces. Yes, it matters.):development: adapter: sqlite3 dbfile: db/dev.db
- Edit the file
That should put you at about Part 4 of the Tutorial. Just remember that all the SQL modifications need to be done with the sqlite3 tool (sqlite3 db/dev.db), so you’ll actually have to manipulate the database by hand. Personally, I don’t mind that. In fact, I prefer it for simple stuff like this since it keeps my SQL skills from getting too rusty. It’s useful to be able to jump into a console on a PostgreSQL or MySQL database and poke around by hand sometimes.

this did not work for me: sudo gem install sqlite3-ruby
I got the following error: Building native extensions. This could take a while… ERROR: While executing gem … (RuntimeError) ERROR: Failed to build gem native extension. Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0 for inspection. ruby extconf.rb install sqlite3\nchecking for sqlite3.h… yes checking for sqlite3_open() in -lsqlite3… no
Results logged to /usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.1.0/ext/sqlite3_api/gem_make.out
so instead I got an older version off of the darwin ports system using: sudo port install rb-sqlite3
jashugan, try running:
sudo gem install fixrbconfig; sudo fixrbconfigTried to install Rails in Panther (10.3.9) using gems. Everything seemed to install OK, but when I try to run rails, I get a ‘command not found’ error.
Only odd thing is that gems installed everything in /sw/var/lib/gems/1.8, rather than /usr/local/lib/ruby/… (I assume that’s something to do with gems itself having been installed through fink).
Any advice on how to fix this little mess would be MOST appreciated.
Oh my. People are still linking to this article and reading it. Oh my. I think I’ll have to add a note pointing people elsewhere to the top of this page…
For those suffering from Shelley’s problem (which I’m sure she’s fixed for herself by now): the fix is to add fink’s
/sw/binand related directories to your PATH. The Fink docs will have nice, clear directions on this task.You just can’t get any better than this. It took longer for me to go get a cup of coffee than it took to install Rails; using the above instructions. I also just took on my first web design project.