I installed RVM, Ruby 1.9.2 and Rails 3.0.9 on Lion which works fine. Only problem is, after I close the terminal I need to execute this:
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] 开发者_运维知识库&& . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
for it to pick up RVM.I then need to make RVM use Ruby 1.9.2 first before I can do Rails stuff again.
How can I make this permanent?
After you first execute
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
you shouldn't need to do it again. That line appends the necessary file inclusion information RVM into your .bash_profile
. If you are using bash
(as opposed to zsh, ksh, csh, tcsh or any other shell), then RVM will be accessible each time you open a new session. If you are using a different shell, that line may need to be in a different startup file. For example, if you are using zsh, then you'll probably want to append it to your ~/.zshrc
file.
Having done this, simply running rvm --default use ruby-1.9.2
once should ensure that you have the desired version of Ruby by default. Note, you should not need to add this line to your .bash_profile
or similar.
try this
rvm --default use ruby-1.9.2
In order to make Terminal (e.g. bash) enable RVM every time you open it, edit ~/.profile
and add the following line to it:
[[ -s "/Users/foo/.rvm/scripts/rvm" ]] && source "/Users/foo/.rvm/scripts/rvm" # This loads RVM into a shell session.
Then to make the RVM's version of ruby default, as fl00r has mentioned, run:
rvm --default use ruby-1.9.2
Alternatively, you can add an .rvmrc
file to the root folder of your app that uses Rails 3.0.9 and specify which version of Ruby you want to use with that project there:
rvm ruby-1.9.2
Even better, you should create a gemset by running rvm gemset create rails-3.0.9
and update you .rvmrc
file to become like this:
rvm ruby-1.9.2@rails-3.0.9
Then run cd into the project once again (you must cd into it once again), and run bundle install.
This way your project will have its own isolated gemset.
this also work for me
rvm --default use 1.9.2
精彩评论