I recently installed Ruby 2.1.1 with RVM, and I set that to the default. In my root directory it correctly sets current to ruby-2.1.1:
$ rvm list
rvm rubies
ruby-1.9.3-p448 [ x86_64 ]
ruby-1.9.3-p545 [ x86_64 ]
=* ruby-2.1.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ which ruby
$ /Users/mynamehere/.rvm/rubies/ruby-2.1.1/bin/ruby
But when I move into my rails project, current is set back to 1.9.3, even though default is 2.1.1:
$ rvm list
rvm rubies
ruby-1.9.3-p448 [ x86_64 ]
=> ruby-1.9.3-p545 [ x86_64 ]
* ruby-2.1.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ which ruby
$ /Users/mynamehere/.rvm/rubies/ruby-1.9.3-p545/bin/ruby
Can someone tell me why the current ruby version changes depending on my directory, and how I can set 2.1.1 to be the default? I've tried doing "$ rvm --default use 2.1.1" in my project directory, but that doesn't fix the issue.
Thanks!
You probably have a .ruby-version
file in your Rails project folder which establishes the default for that project. Check for that and, if you have it, you can remove it or change it's contents to the version you want to use for that particular Rails project.
It's discussed (rather tersely) in the rvm
website under Typical RVM Project Workflow .
You can also define your gemset specific to the project as well. It's a cool feature if you have multiple projects that require different versions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.