I migrated my MacBook using Migration Assistant. I have two rails apps I was working on my previous laptop and now when I try working on those apps on my new laptop one them works properly(Restaurant App) and in the other(Quiz App) when I try to turn on the server I get this
Your Ruby version is 2.2.3, but your Gemfile specified 2.5.1
Both the apps have ruby version 2.5.1. What could be the possible reason the I am able to run the server on one app(Restaurant App) and not the other(Quiz App).
I tried running the command below to switch the ruby version to 2.5.1
brew unlink [email protected] && brew link --force --overwrite [email protected]
but I get an error
No such keg: /usr/local/Cellar/[email protected]
Please help me figure out this problem.
Generally you're better off using a ruby version manager. The two major ones being RVM (https://rvm.io/) and rbenv
I'm personally a big fan of rbenv and its use of shims (I have less trouble when using bundler and switching xcode versions via xcversion personally) https://github.com/rbenv/rbenv
brew install rbenv
rbenv install 2.5.1
rbenv use 2.5.1
optionally you can use a .ruby-version file in your project root to ensure you don't have an issue again. https://github.com/rbenv/rbenv#choosing-the-ruby-version
# in your project root
echo '2.5.1' > .ruby-version
In this way you can easily select whichever version you'd like to use for your application, just by starting it in the project root.