So I think I have a bunch of rubies scattered around here. I want to install rails 3 and watch the railscast online and the person uses rvm to manage ruby versions. I went to install rvm and followed the instruction. I got to the point where I need to do
rvm install 1.9.2
EDIT: and I did
rvm 1.9.2
However after the installation, I try
ruby -v
and get
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
I also go and do
开发者_开发问答which ruby
and get
/usr/bin/ruby
How do I set up my path so that I can use the ruby that is installed using rvm?
inside /Users/denniss/.rvm/bin I have the ruby-1.9.2-rc2
and my .profile looks like
export PATH="$PATH:/Applications/android/tools"
export PATH="$PATH:/Applications/rubystack/apache2/bin"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export PATH="/Users/denniss/.rvm/bin/:/usr/bin:/usr/local/bin:$PATH"
Type:
rvm list
That'll display all the versions of ruby you have.
Then type :
rvm use 1.9.2
And everytime you open you're terminal it will default to your original ruby. To change this type :
rvm --default 1.9.2
Note: You don't need to use RVM to use Rails3. I recommend keeping the ruby v you have, and just installed rails 3 for the new app. Rails 2 and Rails 3 will not overwrite each other.
You have to switch to the new version with rvm 1.9.2
. This is only temporary, however. To permanently set it, you can pass the --default: rvm --default 1.9.2
.
Correct, if RVM is not loading the used ruby into the environment then you are most likely not sourcing it in your profiles.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
This is in both the installer output and the documentation for installation:
http://rvm.beginrescueend.com/rvm/install/
~Wayne
Actually, I forgot to add the
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
at the very end of my ~/.profile
精彩评论