3

RVM won't let me run bundle because it thinks my Ruby version is different from what my Gemfile says, but it isn't:

$ rvm list

rvm rubies

=> ruby-1.9.3-p194 [ x86_64 ]
   ruby-1.9.3-p429 [ x86_64 ]
 * ruby-2.0.0-p195 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin13.0.0]

Gemfile:

ruby '1.9.3-p194'

But then:

$ bundle install
Your Ruby version is 1.9.3, but your Gemfile specified 1.9.3-p194
$ 

This seems like a very strange thing. Any ideas? There are a lot of people who have this question, but their Gemfiles are obviously different from the running version. I've even done rvm use 1.9.3-p194 and then immediately after bundle install but I get the same error. bundle update produces the same error.

If I remove the ruby version from the Gemfile, it will default to 2.0.0 but switching by rvm use to the proper version (to comply with remote server ruby version) actually works. Running bundle install then works.

Could this error come from also having an rvmrc file (even though specifies the same ruby version) in the Rails project as well?

Ben Saufley
  • 3,259
  • 5
  • 27
  • 42

2 Answers2

5

Remove the line and add a file named '.ruby-version' with '1.9.3-p194' in it. The .ruby-version approach is compatible with several ruby managers beyond rvm.

AndyV
  • 3,696
  • 1
  • 19
  • 17
  • Valid point, but not a solution to the problem: I am not using other ruby managers. – Ben Saufley Nov 25 '13 at 22:11
  • But @BenSaufley other collaborators may be, and that is a point of using something that is supposed by several ruby managers, perhaps. – vgoff Nov 25 '13 at 23:08
  • Nah, it's all good. Sometimes it is hard to figure out what is indicated or meant. Deleting prior comments to keep this area clean. :) – vgoff Nov 27 '13 at 02:24
5

The ruby directive explicitly leaves out the ability to specify a patch level. Ruby patches often include important bug and security fixes and are extremely compatible. http://bundler.io/v1.2/gemfile_ruby.html

The entry in your Gemfile should simply be ruby '1.9.3'

Shawn Balestracci
  • 7,380
  • 1
  • 34
  • 52
  • Works for me! Well, I mean, it doesn't work - it tries to load a more recent patch level, and failing that, loads 2.0.0. But this tells me why *that* doesn't work. Thanks! – Ben Saufley Nov 25 '13 at 22:23