ohho
ohho

Reputation: 51911

A different rubygem version for each ruby version in rvm

I have ruby 1.8.7 and 1.9.3 installed by rvm. For each ruby version, I'd like to:

How can I set the above in rvm?

Upvotes: 6

Views: 1542

Answers (3)

socialmatchbox
socialmatchbox

Reputation: 83

If you have already created gemsets in rvm for 1.3.7 and 1.8.x, skip this step. Otherwise, you need to create the gemset.

Here is how to create a gemset and then switch to it: rvm 1.8.7 # switch to ruby 1.8.7 rvm gemset create 1.3.7 # you may have to do it this way: rvm --force rubygems 1.3.7 rvm gemset use 1.3.7 # use it

Next time you want to use ruby 1.8.7 with gemset 1.3.7 you only need to do this: rvm use [email protected] # this sets the ruby version and gem version ruby -v # checks the ruby version, should = 1.8.7 gem --version # checks the gemset version, should = 1.3.7

Repeat this for ruby 1.9.3 and gemset 1.8.x.

You can find out how to do this and find answers to questions other rvm related topics here: http://rvm.io/gemsets/using

Upvotes: 0

Gowri Naidu R
Gowri Naidu R

Reputation: 2034

When install rvm and then rvm install ruby --version its taken latest rubygems version. So just follow the below steps:

  1. rvm use 1.8.7
  2. gem -v, e.g. shows 1.8.24 like that
    If you want to use rubygems particular version only follow steps #3 and #4.
    This is for syntax set the rubygems in rvm
  3. rvm rubygems [x.y.z|latest-x.y|latest|remove]
    Ex like this:
    Retrieving rubygems-1.3.7

    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
    100  284k  100  284k    0     0  94166      0  0:00:03  0:00:03 --:--:--  125k
    Extracting rubygems-1.3.7 ...
    Removing old Rubygems files...
    Installing rubygems-1.3.7 for ruby-1.8.7-p371 ...
    Installation of rubygems completed successfully.
    

    then

  4. gem -v => It shows 1.3.7

  5. rvm rubygems 1.3.7

And If you want use any other version go to step #3

Ex: rvm rubygems latest

Upvotes: 5

ohho
ohho

Reputation: 51911

$ rvm use 1.8.7
$ rvm rubygems 1.3.7
$ rvm use 1.9.3
$ rvm rubygems latest-1.8
$ gem -v
1.8.24
$ rvm use 1.8.7
$ gem -v
1.3.7

Upvotes: 6

Related Questions