Online Help
You can find the RVM team:
mpapis, rys, ddd on IRC in
#rvm on irc.freenode.net
If we do not respond right away, leave a message and a contact to you like email or twitter.
Sponsors
Small Sponsors
$ rvm help # Documentation Index

Named Gem Sets

RVM gives you compartmentalized independent ruby setups. This means that ruby, gems and irb are all separate and self-contained - from the system, and from each other.

You may even have separate named gemsets.

Let's say, for example, that you are testing two versions of a gem, with ruby 1.9.2-head. You can install one to the default 1.9.2-head, then create a named gemset for the other version, and switch between them easily.

Example: testing gems

$ rvm 1.9.2-head@testing

will use a '1.9.2-head@testing' GEM_HOME (be sure to create it first), whereas:

$ rvm 1.9.2-head

will use the default 1.9.2-head GEM_HOME :)

Example: Rails versions & upgrading apps

To illustrate the point, let's talk about a common use case. Assume you are testing out a rails application against a new Rails release. RVM makes such testing very easy, by letting you quickly switch between multiple Rails versions. First, let's set up the environments:

$ rvm 1.9.2-head
$ gem install rails -v 2.3.3

$ rvm gemset create rails222 rails126
Gemset 'rails222' created.
Gemset 'rails126' created.

$ rvm 1.9.2-head@rails222
$ gem install rails -v 2.2.2

$ rvm 1.9.2-head@rails126
$ gem install rails -v 1.2.6

$ rvm 1.8.7
$ gem install rails -v 1.2.3

Note that, for each of the ruby installs above, you can have completely separate versions!

Now that your environments are set up, you can simply switch between Rails versions and Ruby versions as follows.

$ rvm 1.9.2-head@rails126 ; rails --version

Rails 1.2.6

$ rvm 1.8.7 ; rails --version

Rails 1.2.3

$ rvm 1.9.2-head@rails220 ; rails --version

Rails 2.2.0

$ rvm 1.9.2-head ; rails --version

Rails 2.3.3

If you are deploying to a server, or you do not want to wait around for rdoc and ri to install for each gem, you can disable them for gem installs and updates. Just add these two lines to your ~/.gemrc or /etc/gemrc:

gem: --no-rdoc --no-ri

Warning!!!

* RVM gives you a separate gem directory for each and every Ruby version and gemset. * This means that gems must be explicitly installed for each revision and gemset. RVM helps you manage this process; see the RVM set documentation page.

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.

Although I recommend against it, you can use 'rvm gemdup default' and 'rvm gemdup system' to clone user-default gems and system gems respectively. Unless of course I decide to remove this feature, as I am not convinced it is worthwhile :)

RVM Documentation Index