How do I change the default gemset and ruby version for my project?
ruby, rvm
Solution
if you want a specific gemset and ruby version per project just manually create a `.rvmrc` file in your root project directly. In that file add:
ruby-1.9.3-p362@gemset-name --create
Or if you don't want to manually create it, you can have rvm do it for you. `cd` into the root directory of your project and create a `.rvmrc` file like this:
$ rvm use ruby-1.9.3-p194@gemset-name --create --rvmrc
Make sure the `.rvmrc` file contains a line similar to this and in this format:
environment_id="ruby-1.9.3-p392@gemset-name"
Update:
The convention used for setting the ruby version and a gemset per project when using RVM is to use a `.ruby-version` file and a `.ruby-gemset` file in the project's root directory.
A `.ruby-version` file would look like this:
ruby-2.0.0-p598
A `.ruby-gemset` file would look like this:
my_gemset_name
Problem
When I list all the versions of Ruby on my system, I get this: ``` $ rvm list rubies rvm rubies ruby-1.8.7-p370 [ i686 ] ruby-1.9.2-p0 [ x86_64 ] ruby-1.9.2-p320 [ x86_64 ] * ruby-1.9.3-p194 [ x86_64 ] => ruby-1.9.3-p392 [ x86_64 ] ruby-2.0.0-p0 [ x86_64 ] # => - current # =* - current && default # * - default ``` When I list the gemset in a new Terminal window for my project, I see this: ``` $ rvm gemset list gemsets for ruby-1.9.3-p392 (found in /.rvm/gems/ruby-1.9.3-p392) (default) => myapp boso global ``` So, I change the version of `1.9.3` that I want to use: ``` $ rvm use 1.9.3-p194 Using /.rvm/gems/ruby-1.9.3-p194 $ rvm gemset list gemsets for ruby-1.9.3-p194 (found in /.rvm/gems/ruby-1.9.3-p194) => (default) myapp1 myapp2 myapp3 myapp4 global ``` Then I try to set the default for gemset `myapp1` to version `1.9.3-p194` and set it to default and that seems to work: ``` $ rvm use 1.9.3-p194@myapp1 --default Using /.rvm/gems/ruby-1.9.3-p194 with gemset myapp1 ``` But when I launch a new terminal window and do `rvm gemset list`, I end up back at square 1 - using a different versino of ruby - i.e. `1.9.3-p392` instead of `-p194`. ``` $ rvm gemset list gemsets for ruby-1.9.3-p392 (found in /.rvm/gems/ruby-1.9.3-p392) (default) => myapp boso global ``` Does this happen because I don't close my previous terminal window before opening the new one? Do I have to force RVM to save it for all sessions or something? What am I missing? I also tried `rvm --default use 1.9.3.-p194@myapp1` and that gives me the same issue.