views:

126

answers:

3

I have JRuby and Ruby (MRI) installed. It seems that I need to install gems twice - once for each of these platforms. Is this necessary or am I doing it wrong? After I installed the rails gem for MRI, should I have pointed JRuby to it, or was it necessary for me to also call: "jruby -S gem install rails"

+3  A: 

You need to install gems for each different install of ruby that you have.

railsninja
+2  A: 

If you set GEM_HOME you can share your gem installations.

+1  A: 

Some gems target specific platforms, e.g. Mongrel (there's a MRI one and a JRuby one). Also, JRuby cannot use gems that have native extensions (i.e. C code) unless they use the FFI (which most do not - yet).

Personally I have separate gem repos for MRI and JRuby. The little bit of extra hassle is worth the peace of mind when trying to track down a problem.

It's pretty easy to see what each repo has installed:

jruby -S gem list --local

vs.

gem list --local

You could even write a ruby script to sync one gem list to the other, but you'd have to be careful about platform specific gems....

Rob