Open your .bashrc file.
And replace the following line
[ -z “$PS1” ] && return
if [[ -n “$PS1” ]]; then
Now add this to the last line of the file
if [[ -s $HOME/.rvm/scripts/rvm ]] ; then source $HOME/.rvm/scripts/rvm ; fi
This loads RVM into a shell session.
If already have rvm then
if this shows error like ‘downloaded does not match it’s md5 checksum’
$ rvm reload
$ rvm get latest
For ruby 1.9.2 we want the packages it lists under the MRI & ree section. Let’s install those now.
Setting up Ruby
Do rvm list known to know all ‘Ruby implementation made available through RVM’
Then install latest stable release of ruby
You can see the ruby versions installed and currently using ruby version by
To list default ruby
You can change it by
for default : rvm –default 1.9.2-p180
Install rails stable release and then rails 3.1
Start by creating our gemsets
See available gem sets by
If any confusion with rails31 gemset delete it
And create rails31rc
As a best practice, remember to always use one gemset per project*.
Now we have multiple gem set installed. Now set the different gem set for ruby versions.
Install Rails 3.0.7
Select the gemset for Rails 3.1
for default $ rvm use 1.9.2-p180@rails31rc –default
Install Rails 3.1
if not found
Switching from one project to another, from a client to a personal project, from testing the release candidate to developing using the latest stable version, always having to manually switch from using a gemset to another can impact productivity. The project .rvmrc files can increase the development speed by setting up our project’s ruby environment when we switch to the project root directory.
The rule of thumb here is to use a .rvmrc file for each project, for both development and deployment.*
.rvmrc file :
There are three types of .rvmrc files
1) system : on /etc/rvmrc
2) user : $HOME/.rvmrc
3) Project : .rvmrc
Create a new rails App
with mysql as database
$ rails server -p4000
If u get error like
runtime. See https://github.com/sstephenson/execjs for a list of
available runtimes. (ExecJS::RuntimeUnavailable) “””
in your Gemfile add
and do bundle install
$ gem install unicorn
Start unicorn server