问题
When I run ruby -v in my ~home folder, I get:
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]
But now I am trying to run an app, and there are some missing gems. Searching for them, I am told to run this app using Ruby 1.9, but in the /app folder, when I run ruby -v, I get:
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]
Why is it so and how can I recover my 2.0. current version of Ruby?
回答1:
Usually you would use some kind of Ruby version management tool like rvm or rbenv.
These make it possible to have a unique Ruby version for every project (AKA directory), as well as separate gem sets.
Using rvm you can switch your current Ruby by running rvm use ruby-1.8.7.
Check your project directory using ls -a for files like:
- .rvmrc
- .ruby-version
Normally the required Ruby version is selected here and used as soon as you cd into the project directory.
来源:https://stackoverflow.com/questions/17436452/why-are-my-ruby-versions-conflicting