-1

I am trying to run the Rails dev environment in my terminal (using command 'rails c'). I am receiving the error: 'Your Ruby version is 2.6.10, but your Gemfile specified 3.2.2'. I then ran 'which ruby' to make sure I am not on the Mac system Ruby and can confirm that I am not. This is the returned path '/usr/local/opt/ruby/bin/ruby'. As an additional check, I ran 'ruby -v' and terminal returns 'ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-darwin21]'. Why would there be this discrepancy? Is there another path I need to add to my .zshrc file? I've attached screen shots of my terminal and my .zshrc file. Any guidance is greatly appreciated! This is my .zshrc file

I recently reconfigured my .zshrc file so that all paths point to my homebrew installed ruby rather than the Mac system default ruby. My gem env info and all other terminal info return that I am on ruby 3.2.2. Ruby 3.2.2 is specified in my Gemfile, so I expect that I should be able to start my rails dev environment.

  • 1
    A) `which ruby` B) `gem env`. C) Please **do not** post screenshots of text or code, instead copy-paste it into your question. – tadman Aug 22 '23 at 18:24
  • Are you running `rails c` and `ruby -v` in the exact same terminal window? I'm asking because I've seen differences when someone runs ruby in VS Code's terminal vs the actual terminal. And are you running both in the same directory? I'm asking because you may have set up something like `rbenv local 2.6.10` in one directory while using the default ruby version in another directory. – nitsas Aug 22 '23 at 21:10
  • this doesn't answer your specific question, but I suggest you completely remove the Mac system ruby. It can only cause problems. Much better is to use a ruby manager like rvm or rbenv, and bring the ruby versions under your control. – Les Nightingill Aug 23 '23 at 04:50
  • Ruby on Rails 3 is end-of-life and has not been maintained in many years. It does not support either of the two Ruby versions you listed, so it cannot work anyway. – Jörg W Mittag Aug 23 '23 at 10:41

0 Answers0