安装RVM(Ruby版本管理器)

ken*_*123 4 ruby

有人可以将此翻译成我需要采取的可管理步骤:

~ 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.
Run Code Online (Sandbox Code Playgroud)

我是一个完整的新手,所以我甚至不确定哪个是shell的加载文件,我该如何编辑它?

ken*_*123 11

我发现了如何做到这一点,希望这能节省一些时间:

要安装RVM,请在终端中输入以下内容:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Run Code Online (Sandbox Code Playgroud)

一旦你安装了rvm,

根据您使用的文本编辑器,我使用配偶,所以我输入:

mate .bashrc
Run Code Online (Sandbox Code Playgroud)

然后打开文本编辑器窗口后,将此行复制并粘贴到其中:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
Run Code Online (Sandbox Code Playgroud)

现在保存并关闭该窗口.

然后重复:

mate .bash_profile
Run Code Online (Sandbox Code Playgroud)

关闭该终端并重新启动新终端

输入:

rvm use 1.9.1 (or 1.9.2)
Run Code Online (Sandbox Code Playgroud)

然后键入:

ruby -v
Run Code Online (Sandbox Code Playgroud)

你应该看到ruby1.9.1

要恢复默认值,请输入:

rvm default
Run Code Online (Sandbox Code Playgroud)

现在你应该得到ruby 1.8.6(或1.8.7,具体取决于你的默认值).