Suppose you are working on three parallel projects: one uses Ruby 1.9.3 and two use Ruby 2.0.0. Lets say:
- Project A: Ruby 1.9.3
- Project B: Ruby 2.0.0
- Project C: Ruby 2.0.0
When you are working on Project A, you can just say rvm use 1.9.3
, and it will set your current Ruby version to 1.9.3.
Problems arise when you are working on Project B or C, and they are using different versions of the same gem (lets say Project B uses httparty 1.0
, and project C uses httparty 2.0
).
In this case, rvm not only allows you to use different rubies by using rvm use
, but also allows you to use different sets of gems with each Ruby (called gemsets
).
So you can just say(When on project B): rvm use 2.0.0@project_b_gemset (and this will install all the gems required for project B as a different set)
When you are on project C, you can just say rvm use 2.0.0@project_c_gemset
, and this will install all of the gems required for project C as a different set. And hence you can use different sets of gems with the same Ruby version.
Summing up:
rvm use ruby_version@gemset_version:
ruby_version
allows segregation on the basis of Ruby versions and gemset_version
allows you to do further segregation inside the same version of Ruby.