I need to specify a ruby version in my Gemfile for Heroku:
ruby '2.1.1'
That works as expected. However, it messes with my local terminal as well. I try to set the default ruby version and gemset in RVM with:
$ rvm --default use ruby-2.1.1@rails4
Using /Users/scott/.rvm/gems/ruby-2.1.1 with gemset rails4
$ rvm gemset list
gemsets for ruby-2.1.1 (found in /Users/scott/.rvm/gems/ruby-2.1.1)
(default)
global
=> rails4
Seems fine and it works as expected. However, if I open up another terminal shell I get this:
Last login: Fri Mar 14 16:54:23 on ttys009
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /Users/scott/code/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
$ rvm gemset list
gemsets for ruby-2.1.1 (found in /Users/scott/.rvm/gems/ruby-2.1.1)
=> (default)
global
rails4
I want it to use the rails4
gemset always! How can I do this?
Only way you could do it is to add two files to your application: .ruby-version
and .ruby-gemset
and add 2.1.1
in the .ruby-version
file and rails4
in the .ruby-gemset
file.
You can also do this on your command line with:
echo 2.1.1 > .ruby-version
and
echo rails4 > .ruby-gemset
And that will create the files for you with the version 2.1.1 and the gemset rails4
So whenever you open a new terminal, rvm will use ruby 2.1.1 and gemset rails 4
Check out more on rvm documentation
Hope this helps