有人可以将此翻译成我需要采取的可管理步骤:
~ Wayne
You must now finish the install manually:
1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
Please note that this must only occur once - so, you only need to add it the first time you install rvm.
2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly).
This means that if you see '[ -z ] && return' then you must change this line to:
if [[ ! -z ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Be absolutely *sure* to REMOVE the '&& return'.
If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile.
placing all non-interactive items in the .bashrc, including the 'source' line above
3) Then CLOSE THIS SHELL and open a new one in order to use rvm.
[ -z "$PS1" ] && return
WARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
This means that if you see '[ -z $PS1 ] && return' then you must change this line to:
if [[ -n $PS1 ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Even if you use zsh you should still adjust the .bashrc as above.
If you have any questions about this please visit #rvm on irc.freenode.net.
Installation of RVM to /home/kapplej/.rvm/ is complete.
我是一个完全新手,所以我甚至不确定哪个是shell的加载文件,我该如何编辑它?
答案 0 :(得分:11)
我发现了如何做到这一点,希望这能节省一些时间:
要安装RVM,请在终端中输入以下内容:
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
安装rvm后,
取决于您使用的是哪个文本编辑器,我正在使用配偶,因此我输入了:
mate .bashrc
然后打开文本编辑器窗口后,将此行复制并粘贴到其中:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
现在保存并关闭该窗口。
然后重复:
mate .bash_profile
关闭该终端并重新启动新终端
输入:
rvm use 1.9.1 (or 1.9.2)
然后输入:
ruby -v
你应该看到ruby1.9.1
要恢复默认值,请输入:
rvm default
现在你应该得到ruby 1.8.6(或1.8.7,具体取决于你的默认值)。
答案 1 :(得分:2)
我在RVM website:
中遇到同样的问题首次安装RVM时,必须在所有路径加载等之后将最后一行放入您的配置文件中:[[-s“$ HOME / .rvm / scripts / rvm”]]&amp;&amp; ;来源“$ HOME / .rvm / scripts / rvm”
最后在将该行插入OS X上我的用户主目录中的.profile文件,.bash_profile和.bashrc文件后,它才能正常工作。
似乎所有这些都不是必需的。由于RVM网站只是说“在你的个人资料中添加以下内容”,这对我这样一个不知道我的个人资料的菜鸟有点误导。
有人可以告诉我哪些文件(个人资料文件,.bash_profile和.bashrc文件)我可以删除该行吗?
答案 2 :(得分:2)
优于
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
使用:
[[ -s "~/.rvm/scripts/rvm" ]] && source "~/.rvm/scripts/rvm"
如果您使用$HOME
,则在运行sudo bash
时会收到一些丑陋的消息:
WARNING:
Could not source '/usr/local/rvm/scripts/base' as file does not exist. RVM will likely not work as expected.
__rvm_ensure_is_a_function: command not found
__rvm_setup: command not found
cat: /usr/local/rvm/VERSION: No such file or directory
__rvm_conditionally_add_bin_path: command not found
rvm_is_a_shell_function: command not found
__rvm_teardown: command not found