为什么我需要使用“rvm use default"?打开新的终端窗口后? [英] Why do I need to use "rvm use default" after opening new terminal window?

查看:78
本文介绍了为什么我需要使用“rvm use default"?打开新的终端窗口后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在打开一个新的终端窗口 (Mac OSX 10.7.2) 并输入 rails 时,我总是收到有趣的当前未安装 rails..."消息.但我输入了 rvm 使用默认的 1.9.2 一切都很好.

我哪里做错了?

解决方案

Zabba 在评论中说正确的使用命令是 rvm use 1.9.2 --default 是对的.>

RVM 将 default 视为 Ruby,相当于将 Ruby 设置为默认值.如果我在终端中输入 rvm use default,我会得到这个输出:

$ rvm 使用默认值使用/Users/tom/.rvm/gems/ruby-1.9.3-p0

但是,可以在对 rvm use 的调用中列出多个 Ruby,例如:

$ rvm 使用 1.9.3 系统现在使用系统红宝石.$ rvm 使用系统 1.9.3使用/Users/tom/.rvm/gems/ruby-1.9.3-p0

虽然我不完全确定这是否是一个特性(或者传递多个 Ruby 的特定用例,因为如果没有安装最后一个,RVM 似乎不会回退到另一个列出的 Ruby),这意味着当您键入 rvm use default 1.9.2 时,不是将默认值设置为 1.9.2,而是告诉 RVM 使用 1.9.2,因为它是命令中列出的最后一个 Ruby.

如果您运行命令 rvm use 1.9.2 --default 一次,那么您将在打开的每个终端中使用 1.9.2.

关于 multiple-arguments-to-rvm-use-feature 的注意事项:我知道您可以将多个 Ruby 传递给 RVM 命令来运行具有多个 Ruby 版本的脚本,但我看不到 RVM 设置了两个版本的Ruby 立即运行.

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?

解决方案

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.

这篇关于为什么我需要使用“rvm use default"?打开新的终端窗口后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆