Ruby-on-rails RVM 命令:source ~/.rvm/scripts/rvm
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4842566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RVM Command: source ~/.rvm/scripts/rvm
提问by Ads
I'm going through the rails by example tutorial series. I'm trying my best to find solutions prior to asking questions, so if I have missed anything I apologise.
我正在通过示例教程系列来了解 Rails。在提出问题之前,我会尽力找到解决方案,因此,如果我错过了任何内容,我深表歉意。
Every time I need to boot up RVM from the command line in terminal I need to punch a command so that RVM initialises: source ~/.rvm/scripts/rvm
每次我需要从终端的命令行启动 RVM 时,我都需要敲一个命令,以便 RVM 初始化: source ~/.rvm/scripts/rvm
Is this normal? It seems that I cant get the RVM commands to work unless I punch in this code prior. Note I only have to enter the command once, not every time I need to enter an RVM command.
这是正常的吗?除非我事先输入此代码,否则我似乎无法使 RVM 命令工作。注意我只需要输入一次命令,而不是每次需要输入 RVM 命令时。
Many thanks for your help.
非常感谢您的帮助。
回答by Mirko
Put this in your ~/.profileor ~/.bashrc:
把它放在你的~/.profile或~/.bashrc:
# This loads RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
So you don't have to manually type it for every session.
因此,您不必为每个会话手动键入它。
回答by RonanOD
Further Tip
进一步提示
If you want to use gnome terminal (comes as standard in Ubuntu) with rvm, you can do the following:
如果您想在 rvm 中使用 gnome 终端(在 Ubuntu 中是标准配置),您可以执行以下操作:
Edit the default profile. Check the following setting:
"Run command as a login shell"This will stop loading the standard .bashrc by default. Fix this by making a soft link of .rvmrc pointing at .bashrc in your home directory
cd ln -s .bashrc .rvmrc
编辑默认配置文件。检查以下设置:
"Run command as a login shell"默认情况下,这将停止加载标准的 .bashrc。通过创建指向主目录中 .bashrc 的 .rvmrc 软链接来解决此问题
cd ln -s .bashrc .rvmrc
回答by JoeB
Try closing terminal & then re-opening it to install a specific version of ruby:
尝试关闭终端,然后重新打开它以安装特定版本的 ruby:
https://www.youtube.com/watch?v=THG3BKy6JEIat 2:32
https://www.youtube.com/watch?v=THG3BKy6JEI2:32
For example) I typed in "curl -L https://get.rvm.io| bash -s stable --ruby"
例如)我输入了“curl -L https://get.rvm.io| bash -s stable --ruby”
Then I quit terminal & reopened terminal & typed in "rvm install 2.2.3" & it worked :D :)
然后我退出终端并重新打开终端并输入“rvm install 2.2.3”并且它工作了:D :)

