Some users may hit the following error while running bundle install after switching from an Xcode 10.x image to the Xcode 11 image on CircleCI.
The main error message to note is the following:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Why does this happen?
Recent versions of Xcode have removed the previously bundled macOS SDK headers package which installed the various Ruby 2.3 (system Ruby) headers required to build Ruby Gems. Without these headers, some Gems will fail during the bundle install phase with the following error message:
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
Steps to Resolve
This can be resolved by switching to one of the Ruby versions, available via chruby, that we ship with the Xcode 11 images. The versions of Ruby we ship can be found in the Software Manifests.
Follow the steps in our Using Custom Ruby Versions guide to switch to either Ruby 2.5 or Ruby 2.6 Once you have updated your config.yml, push a fresh commit to trigger a fresh build.