Error installing gemfile with fastlane on CircleCI

I have the following gemfile:

source "https://rubygems.org"

gem "cocoapods", "=1.5.3"
gem "cocoapods-check", "=1.1.0"
gem "fastlane", "~> 2.131"

And the following section of pipeline on CircleCI:

- run:
          name: Install Gemfile for Fastlane
          command: bundle check || bundle install --path vendor/bundle

This then produces this output:

#!/bin/bash --login -o pipefail
bundle check || bundle install --path vendor/bundle
^D^DThe following gems are missing
 * minitest (5.12.0)
 * babosa (1.0.3)
 * cocoapods-core (1.5.3)
 * fourflusher (2.0.1)
 * cocoapods (1.5.3)
 * cocoapods-check (1.1.0)
 * excon (0.67.0)
 * json (2.2.0)
 * rubyzip (1.3.0)
Install missing gems with `bundle install`
Fetching gem metadata from https://rubygems.org/........
Using CFPropertyList 3.0.1
Using concurrent-ruby 1.1.5
Using i18n 0.9.5
Using minitest 5.12.0
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 4.2.11.1
Fetching public_suffix 2.0.5
Installing public_suffix 2.0.5
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using atomos 0.1.3
Fetching babosa 1.0.3
Installing babosa 1.0.3
Using bundler 2.0.2
Using claide 1.0.3
Using fuzzy_match 2.0.4
Using nap 1.1.0
Using cocoapods-core 1.5.3
Using cocoapods-deintegrate 1.0.4
Using cocoapods-downloader 1.2.2
Using cocoapods-plugins 1.0.0
Using cocoapods-search 1.0.0
Using cocoapods-stats 1.1.0
Using netrc 0.11.0
Using cocoapods-trunk 1.4.0
Using cocoapods-try 1.1.0
Using colored2 3.1.2
Using escape 0.0.4
Using fourflusher 2.0.1
Using gh_inspector 1.1.3
Using molinillo 0.6.6
Using ruby-macho 1.4.0
Using nanaimo 0.2.6
Using xcodeproj 1.12.0
Using cocoapods 1.5.3
Using cocoapods-check 1.1.0
Fetching colored 1.2
Installing colored 1.2
Fetching highline 1.7.10
Installing highline 1.7.10
Fetching commander-fastlane 4.4.6
Installing commander-fastlane 4.4.6
Fetching declarative 0.0.10
Installing declarative 0.0.10
Fetching declarative-option 0.1.0
Installing declarative-option 0.1.0
Fetching digest-crc 0.4.1
Installing digest-crc 0.4.1
Fetching unf_ext 0.0.7.6
Installing unf_ext 0.0.7.6 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/distiller/project/vendor/bundle/ruby/2.3.0/gems/unf_ext-0.0.7.6/ext/unf_ext
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20190926-723-dvbzjp.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/distiller/project/vendor/bundle/ruby/2.3.0/gems/unf_ext-0.0.7.6 for
inspection.
Results logged to
/Users/distiller/project/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/unf_ext-0.0.7.6/gem_make.out

An error occurred while installing unf_ext (0.0.7.6), and Bundler
cannot continue.
Make sure that `gem install unf_ext -v '0.0.7.6' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  fastlane was resolved to 2.131.0, which depends on
    faraday-cookie_jar was resolved to 0.0.6, which depends on
      http-cookie was resolved to 1.0.3, which depends on
        domain_name was resolved to 0.5.20190701, which depends on
          unf was resolved to 0.1.4, which depends on
            unf_ext
Exited with code 5
CircleCI received exit code 5

As you can see, it seems to fail when installing unf_ext. Why is this? It looks like there’s something wrong with Ruby? Isn’t the latest version 2.4? Why is it using 2.3? How can I solve this?

Hi yusuf,

What version of Xcode are you using? I’m guessing 11 due to the error message and some recent change we’ve made to address this issue.

2.3 is the version or Ruby that comes bundled with macOS Mojave, that we use for all images after Xcode 9.0 (I think?).

Hi marc,

Thanks for the reply. Yes that’s right it’s Xcode 11. Is there a way to resolve this issue?

Oh hold on, it seems to work now. This error was actually produced yesterday but now I just tested it and it’s all fine. Thanks for your work!

Oh brilliant. I was confused - I pushed the fix about 18:00 GMT yesterday, so I’m glad it’s resolved.