0

I know this is a very common question with hundreds of answers and guides however I believe my problem is unique.

After removing rvm and installing Rbenv I now get an error when running rails s or similar commands, the error reads Your Ruby version is 2.6.3, but your Gemfile specified 2.6.4

ruby -v = ruby 2.6.4p104 (2019-08-28 revision 67798) [x86_64-darwin19]
rails -v = Your Ruby version is 2.6.3, but your Gemfile specified 2.6.4

my $PATH: /Users/EthanMorganClark/.rbenv/shims:/Users/JohnDoe/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/JohnDoe/.rvm/bin

Now I can see .rvm/bin is still there, and it shouldn't. This leads me to believe it could be the source of my ruby version problem.

My process: I ran rvm implode and then gem uninstall rvm, then I went into .bashrc, .profile and .bash_profile and removed any traces of rvm. (I did the same with zsh, although I currently am using bash)

I also then ran this script found on the second answer, but in the end it also thinks anything rvm related it gone.

edit - I have also deleted the gemfile.lock, bundled and then get the same error.

Any suggestions, links or answers would be much appreciated. Thanks.

  • What is the output of `gem which rails`? Does prepending the command with `bundle exec` solve the problem? – cesartalves Jul 03 '20 at 15:01
  • The following two commands are needed to troublshoot this further. Most likely you will be able to figure it out by just running these: 1) Running `which rails` will tell you where the `rails` binary is located. 2) `head -1 $(which rails)` will show you the shebang line of this `rails` binary. You will most likely find that it is not what you expect it to be. The output of these two commands should lead to enough information to be able to solve your problem. Please post the output of them in your question. – Casper Jul 03 '20 at 16:01
  • Sorry for the delayed reply, I was time constricted and unfortunately couldnt try any of your solutions. I had to remove rbenv and go back to rvm and just wing it. Thank-you for taking the time to comment. – ethanmclark Jul 09 '20 at 07:42

1 Answers1

0

Your PATH will be used in-order, so having .rvm/bin at the end shouldn't really affect anything. That being said, figuring out how/where your PATH is modified can definitely be tough if you haven't been keeping your .bashrc/.zshrc/.bash_profile/.zlogin etc organized.

A high level list of things you should do:

  • find out what shell you're using, bash or zsh, etc
  • look in all your corresponding rc files for the respective shell for the culprit (try searching all .* files in ~)
  • use which -a ruby/which -a rails/etc to see which executable is invoked when you call it
  • check out this answer for a suggested way to manage your ruby & gem environment
Kache
  • 11,723
  • 10
  • 47
  • 71