How to `bundle install` when your Gemfile requires an older version of bundler?
First you need to install the appropriate version of bundler:
% gem install bundler -v '~> 1.0.0'
Successfully installed bundler-1.0.22
Then force rubygems to use the version you want (see this post):
% bundle _1.0.22_ install
I had the same issue on macOS Mojave. I installed the different version of the bundler gem and uninstall the current version.
gem install bundler -i '2.0.1'
gem uninstall bundler
Then gives me the option to choose the version to uninstall and I choose the one which is creating the problem.
The error message In Gemfile: bundler (~> 1.16)
is a bit inaccurate, since the version number requirement can come from other places, such as the .gemspec
file, which was the case for me:
spec.add_development_dependency "bundler", "~> 1.16"
Removing the version number from the .gemspec
file solved the issue for me:
spec.add_development_dependency "bundler"
This is what I had to do to get it to work to install with a previous version (2.2.11) of bundler:
gem install bundler:2.2.11
bundle _2.2.11_ install