2

I am currently running the following on OSX 10.6.8 and am trying to understand gemsets and gems.

Ruby 1.9.3-p194

Rails 3.2.8

RVM 1.15.6

When I look in .rvm/gems/ I see several gemset directories. Inside each one there is a gems directory. Now, whats the relationship between the non-'@' gemset and the @global gemset?

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
rjd
  • 1,786
  • 2
  • 16
  • 19

1 Answers1

1

From the documentation:

Interpreter global gemsets

RVM provides (>= 0.1.8) a @global gemset per ruby interpreter.

Gems you install to the @global gemset for a given ruby are available to all other gemsets you create in association with that ruby.

This is a good way to allow all of your projects to share the same installed gem for a specific ruby interpreter installation.

To expand on this, the gemset without the @global is the default gemset for that Ruby version. It is essentially a gemset with no name. The @global gemset, however, is special for the reasons outlined in the docs above.

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214
  • Hey Andrew, thanks for the help. I'll do some more reading there. – rjd Oct 02 '12 at 00:36
  • Followup question - if I change gemsets with $ rvm gemset use default and do a $ gem list I see different gems listed. Why does this happen? – rjd Oct 02 '12 at 00:41
  • @rjd Different compared to what? – Andrew Marshall Oct 02 '12 at 00:44
  • 1
    Oh I just found the explanation: NOTE: A little bit about where the default and global gemsets differ. If you don't use a gemset at all, you get the gems in the 'default' set. If you use a specific gemset (say @testing), it will inherit gems from that ruby's @global. The 'global' gemset is to allow you to share gems to all your gemsets. The word 'default' quite literally says it all, eg. the gemset used without selecting one for a specific installed ruby. https://rvm.io/gemsets/basics/ – rjd Oct 02 '12 at 00:46