How to relax your Ruby version specification in your Gemfile

Have you ever run into this error?

Your Ruby version is 2.6.1, but your Gemfile specified 2.6.3

Annoying, right? You know your Ruby version is new enough to run this application, but the Gemfile is so fussy.

Turns out, Gemfiles don’t have to be so picky. Just like you can relax version dependencies for gems, you can also make your Ruby version specifier less specific. As with gems, the secret is using the tiddly-waka (~>) operator:

ruby '~> 2.6.0'

Now this project will run with any patch version of Ruby 2.6 without complaint.


Leave a Reply

Your email address will not be published. Required fields are marked *