Skip to content

Bundler Auto-Install Just Got A Whole Lot Better

Ngan Pham

The RubyGems Team is happy to share this post from our colleague Ngan Pham, Principle Software Engineer @ Gusto. Thank you, Ngan!

Working in a large monolith with many engineers, you never fail to get a flurry of changes everytime you pull from main. Then you have the typical ritual of running bundle install and, if you’re on a Rails application, rails db:prepare. Sometimes, you forget to run bundle install and get this message:

Could not find X-1.2.3 in locally installed gems
Run `bundle install` to install missing gems.

As of Bundler 2.5.10, you can now enable the auto_install config to have Bundler automatically install your bundle on demand. Simply set it in your project (or globally) with:

bundle config auto_install true
# or
bundle config --global auto_install true

Auto-install is not a new concept. Commands like bundle (show | binstubs | outdated | exec | open | console | license | clean) already benefited from the auto_install config.

However, the recent enhancement by @technicalpickles made it work with anything that uses require "bundler/setup". This means even binstubs (which use require "bundler/setup" by default) will now just work.

It’s a small change but it results in a big quality of life improvement. Try it out!


If you would like to share a post about something you love about Bundler or RubyGems on the RubyGems.org blog, we encouraged you to contribute here on GitHub or talk to us on the Bundler Slack.