"Gem::Ext::BuildError: ERROR: Failed to build gem native extension" on Xcode 12 images

The tooling provided by Apple alongside Xcode 12 (the Command Line Tools) has introduced some bugs when building Ruby gems that require native extensions - this is mostly due to changes in the Clang compiler.

In most cases this can be resolved by using one of the additional Rubies we ship with the images (2.7 is recommended). The system Ruby (2.6.3) is known to be very restrictive and problematic when utilising anything that has not been explicitly shipped with it.

The Ruby version can be selected by adding the following to your config file at the beginning of the job:

# ...
name: Set Ruby Version
command: echo 'chruby ruby-2.7' >> ~/.bash_profile

For more information on setting the Ruby version, please see our documentation.

Was this article helpful?
1 out of 12 found this helpful



Article is closed for comments.