The error as shown in the question is solved by the suggestion from Max Pleaner.
gem install bundler
However it soon encountered a second problem:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/gems/json-2.2.0/ext/json/ext/generator
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20191105-34055-mnnpg3.rb extconf.rb mkmf.rb can't find
header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/gems/json-2.2.0
for inspection.
Results logged to
/Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/json-2.2.0/gem_make.out
An error occurred while installing json (2.2.0), and Bundler cannot continue.
Make sure that `gem install json -v '2.2.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
coveralls was resolved to 0.8.21, which depends on
simplecov was resolved to 0.14.1, which depends on
json
The solution it to follow the instruction in this answer: https://stackoverflow.com/a/58084238/58129
I reproduce the steps below:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
sudo xcodebuild -license accept
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
shareeditflag