Let’s see how to update the locked version of bundler in your Gemfile.lock file to a specific bundler version.

Taking as an example the following Gemfile.lock file:

GEM
  remote: http://rubygems.org/
  specs:
    ...

PLATFORMS
  ...

DEPENDENCIES
  ...

BUNDLED WITH
  2.4.6

We’d like to change the BUNDLED WITH version to 2.4.10.

To do so, first make sure you have the desired bundler version installed:

$ gem list bundler

*** LOCAL GEMS ***

bundler (default: 2.4.10, 2.4.6)

If missing, install it:

$ gem install bundler -v 2.4.10

Lastly, update the Gemfile.lock file with the new version:

$ bundle _2.4.10_ update --bundler

And that’s it! The Gemfile.lock file should contain the desired version and bundle --version should also return the exact same version.