安装Ruby on Rails时找不到rvm

时间:2011-08-21 04:23:47

标签: ruby-on-rails installation rvm

我一直在关注本教程,在这个网站上安装Ruby 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'export rvm_project_rvmrc = 1'&gt;&gt; $ HOME / .rvmrc&amp;&amp; rvm reload

所以我完全按照指示输入了这个:

type rvm | head -n1

它说:

-bash: type: rvm: not found

因此,经过长时间的介绍,我的问题就是你知道为什么它似乎没有在安装之后识别rvm类型。我是一个完整的新手,所以请温柔。我遇到了很多问题,直到现在这一点似乎正在顺利进行。

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

2 个答案:

答案 0 :(得分: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脚本本身,它将所有必要的功能加载到您的环境中。

答案 1 :(得分: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