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:
http://ruby.railstutorial.org/
I installed rvm and it wasn't working. The tutorial said to开发者_StackOverflow 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
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. 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/
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. The command you entered will only load the rvm function for a single terminal session.
.rvm/scripts/rvm is a shell script itself that loads all necessary functions into your environment.
Have a look at the same question I posted some time ago.
The install guide says to "register" RVM in the terminal this way:
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; here it's going into .bash_profile
.
As a user of Ubuntu, I found using .bashrc
instead of .bash_profile
worked better.
The difference between .bash_profile
and .bashrc
is outlined here: http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
精彩评论