2011-08-21 74 views
0

安装Ruby我一直on Rails的在Mac上从本网站安装Ruby教程以下未发现:RVM而on Rails的

http://ruby.railstutorial.org/

我安装RVM,它不能正常工作。本教程说输入以下命令:

~ $ [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 

后,我这样做,它似乎,它说这已成功加载:

~ DUFF$ rvm reload 
RVM reloaded! 
~ DUFF$ rvm notes 
Notes for Darwin (Mac OS X) 
For Lion, Rubies should be built using gcc rather than llvm-gcc. Since 
/usr/bin/gcc is now linked to /usr/bin/llvm-gcc-4.2, add the following to 
your shell's start-up file: export CC=gcc-4.2 
(The situation with LLVM and Ruby may improve. This is as of 07-23-2011.) 

For Snow Leopard be sure to have Xcode Tools Version 3.2.1 (1613) or later 
You should download the latest Xcode tools from developer.apple.com. 
    (This is since the dvd install for Snow Leopard contained bugs). 

If you intend on installing MacRuby you must install LLVM first. 
If you intend on installing JRuby you must install the JDK. 
If you intend on installing IronRuby you must install Mono (version 2.6 or greater is recommended). 

To seamlessly abandon the Apple-installed system ruby (ruby 1.8.7 patchlevel 174 for Snow Leopard): 

rvm install 1.8.7 # installs patch 302: closest supported version 
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system # migrate your gems 
rvm --default 1.8.7 


NOTE: For all installations, as of 1.7, RVM no longer autoloads .rvmrc files. In order to  return this functionality, you MUST add 'export rvm_project_rvmrc=1' to your $HOME/.rvmrc file. This causes RVM to override 'cd' which, while toggleable even < 1.7, is currently defaulted to 'off'. This knob returns the previous behaviour to active which causes per-project .rvmrc files to be loaded once again. 

例如:echo '出口rvm_project_rvmrc = 1' >> $ HOME /.rvmrc & & RVM重装

所以,毕竟我进入这个遵医嘱:

type rvm | head -n1 

,它说:

-bash: type: rvm: not found 

这样长的介绍后,我的问题是你知道它为什么不承认RVM类型它似乎已经安装之后。我是一个完整的新手,所以请温柔。我一直在讨论很多问题,直到现在这个问题似乎都很顺利。

任何帮助,将不胜感激。谢谢。

回答

1

您是否正在学习本教程? http://beginrescueend.com/rvm/install/

您应该运行此命令全:

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile 

这样它添加到你的.bash_profile文件,并在每一个新的终端加载。您输入的命令只会为单个终端会话加载rvm函数。

.rvm/scripts/rvm是一个shell脚本,它将所有必要的函数加载到您的环境中。

+0

感谢您的答复。我试过这个命令,我仍然得到相同的回应。但是,我是一个新手,我可能会错误地进行测试。要查看它是否有效,我只需键入: rvm --version 这就是我如何看到它的工作原理。我仍然收到说没有找到rvm命令的错误。我很困惑。 – Matt

+0

首先,您应该验证您是否运行'cat〜/ .bash_profile'正确运行命令,并确保您看到[[-s“$ HOME/.rvm/scripts/rvm”]] &&。 “$ HOME/.rvm/scripts/rvm”#在输出结尾处加载RVM函数。如果你这么做,像@jonallard建议的那样,打开一个新的终端,或运行命令'source〜/ .bash_profile'来重新加载你的环境。你还应该通过列出目录“ls〜/ .rvm”来确保你拥有所有的rvm脚本。你应该看到bin,脚本,配置等等。如果一切都失败,请删除rvm目录'sudo rm -R〜/ .rvm'并从顶部开始。 –

+0

另外,如果你重新开始,我建议从最新的git版本安装,运行'bash <<(curl -s https://rvm.beginrescueend.com/install/rvm)',注意'bash'不是一些占位符为您的shell提示符,它的命令的一部分...对不起,以解释但不知道你怎么noob ...哈哈 –

0

看一看the same question I posted some time ago.

的安装指南说,在终端“注册” RVM这样:

user$ echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile 

基本上,当你在你的shell加载RVM功能,在那里你”重新放置指令取决于你的分布;这里是进入.bash_profile。作为Ubuntu的用户,我发现使用.bashrc而不是.bash_profile效果更好。

.bash_profile.bashrc之间的差额,这里概述:http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

+0

感谢您的回复。我尝试过,似乎没有工作,尽管我已经与不同的人的建议非常混乱,我不知道我是否会把它弄得更糟。我也检查过你提到的上一个线程。它说,要删除以前的安装,然后再试一次。我如何删除以前的安装?对于新问题抱歉。我们必须从某个地方开始,对吧? – Matt

+1

发出'user $ echo'[[-s“$ HOME/.rvm/scripts/rvm”]] &&后。 “$ HOME/.rvm/scripts/rvm”#加载RVM函数'>>〜/ .bashrc'(注意“rc'”,你试过关闭并重新打开你的终端窗口吗? –

+0

工作。帮助这个newb出来! – Matt