tags:

views:

67

answers:

2

Is it possible to run jRuby and native ruby on the same machine?

For example installing rake or gem under both it find's Matz Ruby extensions /usr/bin/gem or /usr/bin/rake

The MRI gems and jruby gems are mixed up.

Is there any experience in that constellation ?

Thanks erhard

+5  A: 

Take a look at RVM (Ruby Version Manager), which

...is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems.

Mike Woodhouse
+2  A: 

rvm on Unix and pik on Windows are the most typical ways to handle multiple ruby versions on the same machine.

But it can be done without any external tools easily too. Just install JRuby in any location you want and add JRuby's bin directory to your PATH. I typically add jruby at the end of the PATH, so that when I type gem or rake, C-Ruby is used, and when I want to use jruby I type:

jruby -S gem  -- to run gem with JRuby
jruby -S rake -- to run rake with JRuby
jruby -S spec -- to run rspec with JRuby

Alternatively, you could use jgem, jrake launcher scripts or aliases, if that's easier to type.

VVSiz