简体   繁体   English

在Ruby on Rails上安装时找不到rvm

[英]rvm not found while installing Ruby on Rails

I have been following the tutorial to install Ruby on Rails on the mac from this website: 我一直在遵循从该网站在Mac上安装Ruby on Rails的教程:

http://ruby.railstutorial.org/ http://ruby.railstutorial.org/

I installed rvm and it wasn't working. 我安装了rvm,但无法正常工作。 The tutorial said to enter this command: 本教程说要输入此命令:

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

After I did that it seemed to have loaded successfully as it said this: 在我这样做之后,它似乎已经成功加载,因为它说:

~ 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.

Example: echo 'export rvm_project_rvmrc=1' >> $HOME/.rvmrc && rvm reload 示例:echo'export rvm_project_rvmrc = 1'>> $ HOME / .rvmrc && rvm重新加载

So after all of that I entered this as directed: 因此,按照我的指示输入所有内容:

type rvm | head -n1

and it said: 它说:

-bash: type: rvm: not found

So after that long introduction my question would be do you know why it is not recognizing the rvm type after it seemed to have installed. 因此,在进行了漫长的介绍之后,我的问题是您是否知道为什么在安装了rvm类型之后无法识别rvm类型。 I am a complete newbie so please be gentle. 我是一个新手,所以请保持温柔。 I have been having a ton of issues and this seemed to be moving along nicely up until this point. 我一直遇到很多问题,直到现在为止,这似乎进展顺利。

Any help would be appreciated. 任何帮助,将不胜感激。 Thanks. 谢谢。

Are you following this tutorial? 您是否在关注本教程? http://beginrescueend.com/rvm/install/ http://beginrescueend.com/rvm/install/

You should run this entire command: 您应该运行整个命令:

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

That way it's appended to your .bash_profile file, and loaded in every new terminal. 这样,它将被附加到您的.bash_profile文件中,并在每个新终端中加载。 The command you entered will only load the rvm function for a single terminal session. 您输入的命令将仅为单个终端会话加载rvm函数。

.rvm/scripts/rvm is a shell script itself that loads all necessary functions into your environment. .rvm / scripts / rvm本身就是一个Shell脚本,可将所有必需的功能加载到您的环境中。

Have a look at the same question I posted some time ago. 看看我前段时间发布的同一问题。

The install guide says to "register" RVM in the terminal this way: 安装指南说要通过以下方式在终端中“注册” RVM:

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

Basically, when you load the RVM function in your shell, where you're going to put the instruction depends on your distribution; 基本上,当您在外壳中加载RVM函数时,要放置指令的位置取决于您的发行版; here it's going into .bash_profile . 在这里,它进入.bash_profile

As a user of Ubuntu, I found using .bashrc instead of .bash_profile worked better. 作为Ubuntu的用户,我发现使用.bashrc代替.bash_profile效果更好。

The difference between .bash_profile and .bashrc is outlined here: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html .bash_profile.bashrc之间的区别在此处概述: http : //www.joshstaiger.org/archives/2005/07/bash_profile_vs.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM