February 12, 2011
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.
Here’s how I got ROR running on my MacBook:
- Install Git here
- Install RVM from a Terminal like this:
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
- add this to ~/.profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
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:
$ rails new Weblog
$ cd Weblog
$ rails generate scaffold Story title:string posted_on:date storytext:text
$ rake db:migrate
$ rails s
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.