# Rails complains wrong ruby version

**URL:** <https://discuss.rubyonrails.org/t/rails-complains-wrong-ruby-version/81576>\
**Category:** rubyonrails-talk\
**Created:** [October 17, 2022, 5:30pm UTC](https://discuss.rubyonrails.org/t/rails-complains-wrong-ruby-version/81576 "2022-10-17T17:30:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fugee\_ohu](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/fugee_ohu/32/14370_2.png) [@fugee\_ohu](https://discuss.rubyonrails.org/u/fugee_ohu)\
**Post date:** [October 17, 2022, 5:30pm UTC](https://discuss.rubyonrails.org/t/rails-complains-wrong-ruby-version/81576/1 "2022-10-17T17:30:59Z")

</div>

rails complains that the ruby version in my gemfile and the ruby version i’m using are different even though i’ve matched them up with rvm and removed .ruby-version file I’ve read solutions like reinstalling bundler but none of those tricks helped

---

<div class="post-metadata">

**Author:** ![brenogazzola](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/brenogazzola/32/3856_2.png) [@brenogazzola](https://discuss.rubyonrails.org/u/brenogazzola)\
**Post date:** [October 17, 2022, 9:39pm UTC](https://discuss.rubyonrails.org/t/rails-complains-wrong-ruby-version/81576/2 "2022-10-17T21:39:53Z")

</div>

Execute `ruby -v` in the terminal and make sure that the ruby version you think it’s using is really the correct one. If RVM is not in the path, or not being loaded in new terminals, you might be using the system version, not the one installed by RVM.

---

<div class="post-metadata">

**Author:** ![fugee\_ohu](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/fugee_ohu/32/14370_2.png) [@fugee\_ohu](https://discuss.rubyonrails.org/u/fugee_ohu)\
**Post date:** [October 17, 2022, 9:49pm UTC](https://discuss.rubyonrails.org/t/rails-complains-wrong-ruby-version/81576/3 "2022-10-17T21:49:01Z")

</div>

Thanks but it returned 3.1.2 and there’s no system ruby installed

---

<div class="post-metadata">

**Author:** ![brenogazzola](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/brenogazzola/32/3856_2.png) [@brenogazzola](https://discuss.rubyonrails.org/u/brenogazzola)\
**Post date:** [October 17, 2022, 9:52pm UTC](https://discuss.rubyonrails.org/t/rails-complains-wrong-ruby-version/81576/4 "2022-10-17T21:52:53Z")

</div>

Are you using an IDE like Rubymine? Those usually have an SDK option that overrides the system ruby version inside their own terminals.

 ![Screen Shot 2022-10-17 at 18.52.31](https://global.discourse-cdn.com/rubyonrails/original/2X/4/4663d5061b58091c29efbbfb0dabe3712fb23cec.png)

---

<div class="post-metadata">

**Author:** ![fugee\_ohu](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/fugee_ohu/32/14370_2.png) [@fugee\_ohu](https://discuss.rubyonrails.org/u/fugee_ohu)\
**Post date:** [October 17, 2022, 10:04pm UTC](https://discuss.rubyonrails.org/t/rails-complains-wrong-ruby-version/81576/5 "2022-10-17T22:04:14Z")

</div>

I’m using atom in development and vi on the server

---

<div class="post-metadata">

**Author:** ![monfresh](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/monfresh/32/8889_2.png) [@monfresh](https://discuss.rubyonrails.org/u/monfresh)\
**Post date:** [October 20, 2022, 3:50pm UTC](https://discuss.rubyonrails.org/t/rails-complains-wrong-ruby-version/81576/7 "2022-10-20T15:50:54Z")

</div>

I would recommend keeping the `.ruby-version` file. That’s how version managers know which Ruby version to switch to when you `cd` into your project. To avoid having to remember to update the Ruby version in 2 places every time you need to change it, I recommend pointing to the `.ruby-version` file in your Gemfile, like this:

```ruby
ruby File.read(".ruby-version").strip

```

instead of `ruby "3.1.2"`

If you recently changed the version in your Gemfile, you’ll need to run `bundle install` again. And sometimes you need to `cd` out of your Rails app and back in for the version manager to pick up the new version in your updated `.ruby-version`.

Also, to help narrow down the issue, try running all commands in the Terminal only. Are you able to run `bundle install` and then `bin/rails s` from the Terminal? If so, try again with your previous setup. If it fails, then that means the issue is specific to your setup.

Also, what does “vi on the server” mean? Can you post a screenshot of your setup and in which application you’re getting the Ruby version mismatch error?
