Leif Thoughts

Grep Bundler Version From Gemfile.lock

·1 min

If you’re working on any kind of Ruby project you probably won’t be able to avoid bundler.

This is just a quick tip to install the exact same version of bundler than the Gemfile was originally installed with.

Here you go:

gem install bundler -v $(grep 'BUNDLED WITH' -A1 Gemfile.lock | tail -n 1 )

I used it a couple of times and it can be useful to keep bundler versions in sync when you’re using docker.