Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I need to use "rvm use default" after opening new terminal window?

On opening a new terminal window (Mac OSX 10.7.2) and entering rails, I get the always fun 'rails is not currently installed..." message. But I enter rvm use default 1.9.2 and all is good with the world.

Where did I go wrong?

like image 449
KevDog Avatar asked Nov 06 '11 11:11

KevDog


1 Answers

Zabba is right in the comments when he says the correct command to use is rvm use 1.9.2 --default.

RVM considers default to be a Ruby, equivalent to the Ruby set to the default. If I type rvm use default into my terminal, I get this output:

$ rvm use default
Using /Users/tom/.rvm/gems/ruby-1.9.3-p0

However, there is the ability to list multiple Rubies in your call to rvm use, e.g:

$ rvm use 1.9.3 system
Now using system ruby.

$ rvm use system 1.9.3
Using /Users/tom/.rvm/gems/ruby-1.9.3-p0

Although I am not entirely sure whether this is a feature (or the particular use case for passing multiple Rubies since RVM doesn't appear to fall back on the other listed Ruby if the last one isn't installed), it means that when you type rvm use default 1.9.2, rather than setting the default to 1.9.2, you are telling RVM to use 1.9.2, since it is the last Ruby listed in the command.

If you run the command rvm use 1.9.2 --default once, you will then be using 1.9.2 in every terminal you open.

NB on the multiple-arguments-to-rvm-use-feature: I know that you can pass multiple Rubies to the RVM command to run a script with multiple versions of Ruby but I can't see RVM setting two versions of Ruby to run at once.

like image 141
nobody Avatar answered Nov 15 '22 12:11

nobody