3

I have only ruby-2.3.7 in my machine and the output of the rvm list rubies is

=* ruby-2.3.7 [ x86_64 ]

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

but when i try to do rails s I get an error saying Your Ruby version is 2.6.4, but your Gemfile specified 2.3.7

I'm not sure how to find out where this particular version of ruby exists in the machine and how to uninstall it or make this error go away.

I cannot change the version of ruby being used in the gemfile though.

Edit.

The output of which ruby is /Users/myname/.rvm/rubies/ruby-2.3.7/bin/ruby

the output of bundle env is

Bundler             1.17.3
  Platforms         ruby, x86_64-darwin-18
Ruby                2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin18]
  Full Path         /Users/bennetsunder/.rvm/rubies/ruby-2.3.7/bin/ruby
  Config Dir        /Users/bennetsunder/.rvm/rubies/ruby-2.3.7/etc
RubyGems            3.0.6
  Gem Home          /Users/bennetsunder/.rvm/gems/ruby-2.3.7
  Gem Path          /Users/bennetsunder/.rvm/gems/ruby-2.3.7:/Users/bennetsunder/.rvm/gems/ruby-2.3.7@global
  User Path         /Users/bennetsunder/.gem/ruby/2.3.0
  Bin Dir           /Users/bennetsunder/.rvm/gems/ruby-2.3.7/bin
Tools               
  Git               2.20.1 (Apple Git-117)
  RVM               1.29.8 (latest)
  rbenv             not installed
  chruby            not installed
  rubygems-bundler  (1.4.5)
thebenman
  • 1,621
  • 14
  • 35
  • What is the output of `which ruby` in your terminal? – Hamed Sep 28 '19 at 14:12
  • By any chance is there a value set for the environment variable `BUNDLER_SPEC_RUBY_VERSION`? You can verify this in the terminal with the command `echo $BUNDLER_SPEC_RUBY_VERSION` – Hamed Sep 28 '19 at 15:29
  • Possible duplicate of [How to fix "Your Ruby version is 2.3.0, but your Gemfile specified 2.2.5" while server starting](https://stackoverflow.com/questions/37914702/how-to-fix-your-ruby-version-is-2-3-0-but-your-gemfile-specified-2-2-5-while) – Mike 'Pomax' Kamermans Sep 28 '19 at 15:47
  • `bundle env` gives you a lot of info about the bundler environment. At the beginning of the very copious output it tells you about the ruby version it's using. Check it's the one that is managed by rvm. – Les Nightingill Sep 29 '19 at 00:26
  • @Hamed there is no value set for that command. its just prints and empty line – thebenman Sep 29 '19 at 03:50
  • @LesNightingill bundle env points to 2.3.7 I can't see where 2.6.4 is on my system. – thebenman Sep 29 '19 at 04:07

1 Answers1

0

I realised that I had installed ruby-2.6.4 view brew and it was on the path. To fix this you either do brew uninstall ruby and work with the one installed via rvm or remove the path entry which fetches from brew installation directory.

thebenman
  • 1,621
  • 14
  • 35