Wednesday, September 30, 2009

Managing multiple ruby versions and rails versions with rvm

by Sandip Ransing 2 comments
Tags

While working with many projects that uses different ruby versions and rails versions, one big problem arises that how do we manage all this ?

We know that managing multiple rails versions wont be problem at all.
but what about ruby versions, How one can manage multiple ruby versions. also while upgrading or degrading ruby version, we need to install all gems again including rails.
i know this is a big pain :(
How we can overcome this headache. meantime there must be some incompatibilities between two different ruby and rails versions.

Yesterday, i did some research and came to know that...

+ ruby 1.8.7 and rails 2.3.3 got quite stability and effectively. we can use it in next developments.
+ Also, after installing ruby 1.9.1 and dependent gems for my project,
and wondering that there are many incompatibilities while installing new gems with ruby 1.9.1

Some of the gems are mysql, ferret, acts_as_ferret, erubies, etc.

Today, while google, i found rvm gem and that seems very nice to manage multiple ruby versions.


Here are some steps explaining how to use it.

# Install rvm gem to manage multiple ruby version
# pre-requisite is that we already have ruby and rubygems installation
1. sudo gem install rvm

# Install rvm for a particular user
# It will also show how to use gem
2. rvm-install

3. Open new shell

# Show all ruby, jruby installations
4. rvm list

# Install ruby
# specify ruby version
5. rvm install RUBY_VERSION_TO_BE_INSTALLED
(rvm install 1.9.1)

# Install jruby
# By default it will install jruby-1.3.1
6. rvm install jruby

# Specify which ruby version to use ?
# Note: Be sure that ruby version is installed
7. rvm use RUBY_VERSION_TO_USE
(rvm use 1.9.1)

#. Default i.e. version before rvm gem installation
8. rvm use default

Sounds, cool :)

blog comments powered by Disqus

About The Author

Sandip is a ruby on rails developer based in pune and also a blogger at funonrails. Opensource contributor and working with Josh software Private Limited. for more info read Follow Sandip on Twitter for updates.

Connect With Me...

Github Projects

@sandipransing Twitter