安装RVM(Ruby版本管理器)

安装RVM(Ruby版本管理器),ruby,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

请有人将此转化为我需要采取的可管理步骤:

~ 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.
~Wayne
现在必须手动完成安装:
1) 在所有路径/变量设置之后,将以下行放在shell加载文件(.bashrc或.bash_profile for bash,.zshrc for zsh)的末尾:
[[-s$HOME/.rvm/scripts/rvm]]&源代码$HOME/.rvm/scripts/rvm
请注意,这只能发生一次-因此,您只需要在第一次安装rvm时添加它。
2) 确保.bashrc文件中没有“return”。(否则rvm将无法正常工作)。
这意味着如果您看到“[-z]&&return”,则必须将此行更改为:
如果[!-z]];然后
... 位于&&返回行下方的原始内容。。。

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

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

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
打开文本编辑器窗口后,复制并粘贴该行:

[[ -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,取决于您的默认设置)

我在以下步骤中遇到了问题:

第一次安装RVM时,在所有路径加载等之后,您必须在配置文件的最后放入以下行:[-s“$HOME/.RVM/scripts/RVM”]]&源“$HOME/.RVM/scripts/RVM”

在OS X上我的用户的主目录中的.profile文件、.bash_profile文件和.bashrc文件中插入该行之后,它终于可以工作了

似乎所有这些都不是必要的。由于RVM网站只说“在你的个人资料中加入以下内容”,这对像我这样不知道我的个人资料是什么的noob来说有点误导

有人能告诉我哪些文件(profile file、.bash_profile和.bashrc文件)我可以从中删除该行吗?

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
使用:

如果您使用
$HOME
,当您运行
sudobash
时,您会收到一些难看的消息:

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

我刚刚测试了这一点,如果我只在.profile文件中包含这一行,那么RVM对我有效。仅供参考。好吧,我终于弄明白了。这行代码只需要在.bash_概要文件中。奇怪的是,在对这些文件所做的任何更改生效之前,您需要打开一个新的终端窗口,因此这导致我无法确定这些文件中的哪些文件需要这行代码,并为您提供“rvm是一个函数”响应,您需要验证rvm是否正确安装(但我不确定)使用“reload rvm”命令是否也可以工作。您可以使用“source.bash_profile”在开放终端内重新加载配置文件。当然。在irc.freenode.net上跳上#rvm,我们就可以这样做。我们不应该获得稳定的版本而不是头分支吗?
\curl-sSLhttps://get.rvm.io |bash-s稳定--ruby
-另外,如果它在.bashrc中,为什么.bash\u配置文件需要更新?
[[ -s "~/.rvm/scripts/rvm" ]] && source "~/.rvm/scripts/rvm"
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