Ruby on Rails envy part 3 – Getting started with Rails 3 on Snow Leopard

This is the third post about getting started on Ruby on Rails. Now I’m on my MacBook, which I ust upgraded from 10.5 to 10.6.6. Since Ruby is already installed on the Mac, I did not need to use the Bitnami virtual machine I used in the previous articles.

Installing Rails

Here’s how I got ROR running on my MacBook:

  • Install Git here
  • Install RVM from a Terminal like this:
    [code lang=”bash”]
    bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
    [/code]
  • add this to ~/.profile:
    [code lang=”bash”]
    [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
    [/code]
    Then logout the terminal and log back in.

  • Install Rails 1.9.2 like so:
    [bash] rvm install 1.9.2 [/bash]
  • Set 1.9.2 as default like so: [bash]rvm –default 1.9.2[/bash]
  • Install Rails 3: [bash]gem install rails[/bash]
  • Install sqlite 3 [bash] gem install sqlite3-ruby[/bash]
  • Check versions with [bash] rails -v[/bash] and [bash] ruby -v [/bash] and see if they’re OK
  • The cool thing about install Rails like this is that everything is installed in my home folder, and you can completely run your apps from you home folder. So you don’t need elevated rights to install or run an application.

    Get the party started

    Create a new Rails project:
    [bash]
    $ rails new Weblog
    $ cd Weblog
    $ rails generate scaffold Story title:string posted_on:date storytext:text
    $ rake db:migrate
    $ rails s
    [/bash]

    Now, browse to http://localhost:3000/stories to take a look at your app.

    At least you know everything is running well and I am at the same point I was here. Next time (maybe tomorrow), let’s check out what actually happened.