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

China☆狼群 提交于 2019-12-07 03:09:43

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/8026754/why-do-i-need-to-use-rvm-use-default-after-opening-new-terminal-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!