Named Gem Sets
RVM gives you compartmentalized independent ruby setups. This means that ruby, gems and irb are all separate and self-contained from 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 and 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. Let us assume that we are testing out a rails application in order to upgrade it to the latest Rails from a previous version. RVM makes such testing very easy as it lets 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, on each of the ruby installs above, you can have completely separate versions! Now that our environments are set up, switching between Rails versions and Ruby versions is quite simple:
∴ 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
Warning!!!
* RVM gives you a separate gem directory for each and every Ruby version and gemset. * What this means is that gems will have to be explicitly installed for each revision and gemset. RVM provides you with a simple way to manage this process; see the ' RVM gem ' page.
Although I recommend against it, if you are sure 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 worthwile :)