7

Why doesn't rvm switch to @project_gemset when I cd into my project's directory? The gemset name in my .ruby-gemset file matches the name listed from rvm gemset list.

> cd project
> ls -A
.ruby-gemset
> cat .ruby-gemset
project_gemset
> rvm gemset list

gemsets for ruby-1.9.3-p392 (found in /Users/david/.rvm/gems/ruby-1.9.3-p392)
=> (default)
   global
   project_gemset
David Winiecki
  • 4,093
  • 2
  • 37
  • 39
  • Note that you can, however, have a .ruby-version without a .ruby-gemset. RVM will switch to that Ruby and will use the default gemset. – David Winiecki Nov 16 '15 at 03:39

1 Answers1

18

It seems you must have both a valid .ruby-version file and a .ruby-gemset file in order for rvm to make the switch.

I was hoping it would switch gemsets and use the default ruby version, since the gemset is one of the existing gemsets for my default ruby. But that's not how it works.

David Winiecki
  • 4,093
  • 2
  • 37
  • 39
  • 1
    Please mark this as accepted. Also, since not all rubygems are compatible with all versions of Ruby, you need a `.ruby-version` as well. If I had a directory with two projects than run on Ruby 1.8.7 and 1.9.2 respectively, and I use Ruby 2.0 as my default for everything else, when I switch into each directory, I want to have RVM automatically switch me over to the correct Ruby version so I know that all the gemsets (and my project) will run in my environment without having to do anything extra. – Paul Fioravanti Jun 01 '13 at 03:26
  • It makes sense that it works that way, requiring both files, because if it allowed you to omit the .ruby-version and you were to change your default ruby in rvm, rvm would no longer put you on the correct ruby when switching into the project. – David Winiecki Jun 27 '13 at 23:26