This comes about because the Gem installation directory used by the gem
command, seen when using gem env
, is set to something like:
In Ruby 1.9.0, the C interface was changed from the Ruby 1.8 series.
Gems that compile to native code had to be recompiled.
The interface was again changed in Ruby 1.9.1 and kept the same in Ruby 1.9.2 & 3. This explains the 1.9.1 you are seeing in your path.
The idea is that you can install different versions of Ruby on your system and that gems would be shared within groups having the same C api. So Ruby 1.8.6 and 1.8.7 could share their gems, and so could Ruby 1.9.1, .2 and .3.
It's not necessarily the best idea, though. In any case, most people use rvm
to access different versions of Ruby and rvm
keeps gems separate for each version, irrespective of the C api version.
I think it's because these versions should be compatible, and if you had separate directories, you'd have to reinstall all your gems with it. This way you can upgrade the version of ruby without having to reinstall all the gems.