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.