I used to have three ruby versions installed on my computer, ruby 1.8.7 (*default), ruby 1.9.1p129, and jruby 1.3.0 (ruby 1.8.6p287). I installed separately on /usr and /opt. If I want use non default ruby, I simply use /path/to/ruby or using alias ruby=/path/to/ruby.
Today, I try a new gem by Wayne Seguin called Ruby Version Manager (RVM), an easy way to install and switch multiple ruby versions and it makes my life easier. RVM support three interpreters and six versions, like MRI 1.8.6, MRI 1.8.7, 1.9.1, 1.9.2, Ruby Enterprise Edition 1.8.6, JRuby 1.3.1.
Installing RVM is extremely easy.
:~ % gem install rvm Successfully installed rvm-0.0.24 1 gem installed :~ % rvm-install [... follow the prompts ...]
And everything is installed into ~/.rvm. RVM usage:
:~ % rvm install ruby -v 1.9.1 <i> Installing Ruby from source to: /home/alifity/.rvm/ruby-1.9.1-p243 <i> Extracting ruby-1.9.1-p243... <i> Configuring ruby-1.9.1-p243 using --enable-shared, this may take a while depending on your cpu(s)... <i> Compiling ruby-1.9.1-p243, this may take a while, depending on your cpu(s)... <i> Installing ruby-1.9.1-p243 <i> Installing rubygems dedicated to ruby-1.9.1-p243... <i> Installation of ruby-1.9.1-p243 complete. <i> Installing rake :~ % rvm use 1.9.1 <i> Switching to ruby 1.9.1 ... :~ % ruby -v ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux] :~ % rvm use jruby <i> Switching to jruby 1.3.1 ... :~ % ruby -v jruby 1.3.0 (ruby 1.8.6p287) (2009-06-03 5dc2e22) (Java HotSpot(TM) Client VM 1.6.0_13) [i386-java] :~ % rvm use default <i> Switching to default ... :~ % ruby -version ruby 1.8.7 (2008-08-11 patchlevel 72) [i586-linux]
For more examples, look at here.
As noted by RubyInside, RVM is still in its early days, hence, don’t try this on your production boxes. If you want to contribute, join on irc.freenode.net in #rvm channel. And if you have a problem, you can run rvm debug as well as rvm ((command you tried to run)) --debug and post it on online code snippets, then post the url to the channel.
For more information about RVM development progress, you can visit RVM project pageĀ on PivotalTracker and Github.
Hi.. I am Alif Rachmawadi. As a web developer, I love to build web application using