Brew: Homebrew development commands fail to install some gems on Mojave on Xcode >10

Created on 19 Jan 2019  Ā·  58Comments  Ā·  Source: Homebrew/brew

What you were trying to do (and why)

Run brew audit on any formula, e.g., brew audit gmp.

What happened (include command output)

The error is Gem::Ext::BuildError: ERROR: Failed to build gem native extension. Full output below:


Command output

Fetching gem metadata from https://rubygems.org/........
Using ast 2.4.0
Using bundler 2.0.1
Fetching json 2.1.0
Using docile 1.3.1
Using simplecov-html 0.10.2
Using tins 1.20.2
Using thor 0.19.4
Using diff-lcs 1.3
Fetching hpricot 0.8.6
Fetching jaro_winkler 1.5.2
Installing jaro_winkler 1.5.2 with native extensions
Installing json 2.1.0 with native extensions
Installing hpricot 0.8.6 with native extensions
Using mustache 1.1.0
Using parallel 1.13.0
Using parser 2.6.0.0
Using powerpack 0.1.2
Using rainbow 3.0.0
Fetching rdiscount 2.2.0.1
Installing rdiscount 2.2.0.1 with native extensions
Using rspec-support 3.8.0
Using ruby-progressbar 1.10.0
Using unicode-display_width 1.4.1
Using term-ansicolor 1.7.1
Using parallel_tests 2.27.1
Using rspec-core 3.8.0
Using rspec-expectations 3.8.2
Using rspec-mocks 3.8.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/generator
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190119-5767-u1kt7r.rb extconf.rb
creating Makefile

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/generator
make "DESTDIR=" clean

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby.h:33:
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10: fatal error:
'ruby/config.h' file not found

include "ruby/config.h"

     ^~~~~~~~~~~~~~~

1 error generated.
make: * [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0 for
inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/json-2.1.0/gem_make.out

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

In Gemfile:
coveralls was resolved to 0.8.22, which depends on
simplecov was resolved to 0.16.1, which depends on
json

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/ext/jaro_winkler
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190119-5767-4udt80.rb extconf.rb
creating Makefile

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/ext/jaro_winkler
make "DESTDIR=" clean

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/ext/jaro_winkler
make "DESTDIR="
make: * No rule to make target
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ruby/config.h', needed byadj_matrix.o'. Stop.

make failed, exit code 2

Gem files will remain installed in
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2 for inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.2/gem_make.out

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

In Gemfile:
rubocop was resolved to 0.63.0, which depends on
jaro_winkler
Error: cannot load such file -- rubocop
Please report this bug:
https://docs.brew.sh/Troubleshooting
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire'
/usr/local/Homebrew/Library/Homebrew/style.rb:21:in check_style_impl' /usr/local/Homebrew/Library/Homebrew/style.rb:14:incheck_style_json'
/usr/local/Homebrew/Library/Homebrew/dev-cmd/audit.rb:149:in audit' /usr/local/Homebrew/Library/Homebrew/brew.rb:102:in

'

Reproducibility

At first, I thought it was only a problem on my machine, and linked to me having /usr/include populated under Mojave (which is not supposed to happen) due to a faulty CLT update from Apple.

However, I have now removed and reinstalled both CLT and Xcode, and nuked that faulty include directory, meaning I now have a ā€œnormalā€ Mojave system, and it still happens. Other users have been reporting it, for example here https://github.com/Homebrew/homebrew-core/pull/36156 and there https://github.com/Homebrew/homebrew-core/pull/35934, so there definitely is something to fix here.

_Why do I believe it is a brew issue, and not a ruby issue?_ I have never in my life used Ruby outside of brew, so if something messed it up, it must be brew-related 😢

Have I tried to fix it?

I have run rm -rf /usr/local/Homebrew/Library/Homebrew/vendor/bundle ~/.gem (per @MikeMcQuaid's advice), then brew tests. The tests fail with the same error as above.

Additional info

$ brew config
HOMEBREW_VERSION: 1.9.2-35-gcf32929
ORIGIN: https://github.com/Homebrew/brew
HEAD: cf32929116b2d5193bad9d78cc627d097cf7612c
Last commit: 28 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b7dc0849fc14d3914073e89653442f6e1ce98886
Core tap last commit: 15 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_BINTRAY_KEY: set
HOMEBREW_BINTRAY_USER: fxcoudert
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_LOGS: /Users/fx/Library/Logs/Homebrew
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
CPU: dodeca-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_144
macOS: 10.14.2-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
in progress outdated

Most helpful comment

This solved it for me:

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

I don't have Xcode installed, I only had the CLI Tools.

All 58 comments

Need your ā€˜brew config’ and ā€˜xcode-select —print-path’

I am experiencing same issue with brew audit and managed to run the command with setting HOMEBREW_DEVELOPER and HOMEBREW_RUBY_PATH(to use ruby with rvm).

brew config

HOMEBREW_VERSION: 1.9.2-35-gcf32929
ORIGIN: https://github.com/Homebrew/brew
HEAD: cf32929116b2d5193bad9d78cc627d097cf7612c
Last commit: 18 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: b7dc0849fc14d3914073e89653442f6e1ce98886
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_LOGS: /Users/susem/Library/Logs/Homebrew
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_152
macOS: 10.14.3-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11

xcode-select -p

/Library/Developer/CommandLineTools

brew config and other requested info added at the end of my report.

Same problem.
vendor-install didn't help.
Is there an another way to fix it?

@fxcoudert Have you tried export HOMEBREW_FORCE_VENDOR_RUBY=1?

@MikeMcQuaid setting HOMEBREW_FORCE_VENDOR_RUBY did not fix the issue, but the error is slightly different:

$ echo $HOMEBREW_FORCE_VENDOR_RUBY
1
$ brew config
HOMEBREW_VERSION: 1.9.2-44-g70c5b6f
ORIGIN: https://github.com/Homebrew/brew
HEAD: 70c5b6f8044785cb4a33878d34e020d34caacf2d
Last commit: 20 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: f97971163fab073832eccee4921a5cdd29ae8dbe
Core tap last commit: 68 seconds ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_BINTRAY_KEY: set
HOMEBREW_BINTRAY_USER: fxcoudert
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_FORCE_VENDOR_RUBY: 1
HOMEBREW_LOGS: /Users/fx/Library/Logs/Homebrew
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
CPU: dodeca-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_144
macOS: 10.14.2-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1
XQuartz: 2.7.11 => /opt/X11
$ brew audit gmp
==> Installing or updating 'bundler' gem
Fetching: bundler-2.0.1.gem (100%)
Successfully installed bundler-2.0.1
1 gem installed
Fetching gem metadata from https://rubygems.org/........
Fetching ast 2.4.0
Using bundler 2.0.1
Fetching json 2.1.0
Fetching docile 1.3.1
Installing ast 2.4.0
Installing docile 1.3.1
Fetching simplecov-html 0.10.2
Fetching tins 1.20.2
Installing json 2.1.0 with native extensions
Installing simplecov-html 0.10.2
Fetching thor 0.19.4
Installing tins 1.20.2
Installing thor 0.19.4
Fetching diff-lcs 1.3
Fetching hpricot 0.8.6
Installing diff-lcs 1.3
Fetching jaro_winkler 1.5.2
Installing hpricot 0.8.6 with native extensions
Installing jaro_winkler 1.5.2 with native extensions
Fetching mustache 1.1.0
Fetching parallel 1.13.0
Installing parallel 1.13.0
Fetching powerpack 0.1.2
Installing mustache 1.1.0
Fetching rainbow 3.0.0
Installing powerpack 0.1.2
Fetching rdiscount 2.2.0.1
Fetching rspec-support 3.8.0
Installing rainbow 3.0.0
Fetching ruby-progressbar 1.10.0
Installing rspec-support 3.8.0
Installing ruby-progressbar 1.10.0
Fetching unicode-display_width 1.4.1
Fetching parser 2.6.0.0
Installing rdiscount 2.2.0.1 with native extensions
Installing unicode-display_width 1.4.1
Fetching term-ansicolor 1.7.1
Installing term-ansicolor 1.7.1
Installing parser 2.6.0.0
Fetching parallel_tests 2.27.1
Installing parallel_tests 2.27.1
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/parser
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r
./siteconf20190121-49092-1228dr2.rb extconf.rb
checking for rb_enc_raise() in ruby.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
--ruby=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:535:in
`block in try_link0'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/tmpdir.rb:89:in
`mktmpdir'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:532:in
`try_link0'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:556:in
`try_link'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:765:in
`try_func'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1051:in
`block in have_func'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in
`block in checking_for'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in
`block (2 levels) in postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in
`block in postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in
`postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in
`checking_for'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1050:in
`have_func'
    from extconf.rb:4:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/json-2.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0
for inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/json-2.1.0/gem_make.out

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

In Gemfile:
  coveralls was resolved to 0.8.22, which depends on
    simplecov was resolved to 0.16.1, which depends on
      json


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6/ext/fast_xs
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r
./siteconf20190121-49092-s98url.rb extconf.rb
checking for stdio.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
--ruby=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:571:in
`block in try_compile'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:524:in
`with_werror'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:571:in
`try_compile'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1091:in
`block in have_header'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in
`block in checking_for'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in
`block (2 levels) in postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in
`block in postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in
`postpone'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in
`checking_for'
from
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1090:in
`have_header'
    from extconf.rb:2:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/hpricot-0.8.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6
for inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/hpricot-0.8.6/gem_make.out

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

In Gemfile:
  ronn was resolved to 0.7.3, which depends on
    hpricot
Error: cannot load such file -- rubocop
Please report this bug:
  https://docs.brew.sh/Troubleshooting
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/style.rb:21:in `check_style_impl'
/usr/local/Homebrew/Library/Homebrew/style.rb:14:in `check_style_json'
/usr/local/Homebrew/Library/Homebrew/dev-cmd/audit.rb:149:in `audit'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'

@susemeee please explain are the HOMEBREW_DEVELOPER and the HOMEBREW_RUBY_PATH set to the same path /usr/bin/ruby?

@JuPlutonic Not exactly, instead I put ruby 2.6.0 pulled from rvm and set HOMEBREW_RUBY_PATH to the ruby (from rvm) path.

When I did not put HOMEBREW_DEVELOPER flag to env, Homebrew keeps using its portable-ruby (I don't know exactly why) so I simply put HOMEBREW_DEVELOPER=true.

I think there is some incompatibility between macOS' default Ruby (and probably portable-ruby from Homebrew's) and its native extensions.

I think there is some incompatibility between macOS' default Ruby (and probably portable-ruby from Homebrew's) and its native extensions.

Yes, see: https://github.com/Homebrew/homebrew-cask/issues/52775#issuecomment-444545063 https://openradar.appspot.com/46465917. Apple are aware of it and are working on a fix. I'm not sure why this doesn't affect everyone.

I just observed the bug while I was trying to push a new version of SwiftGen… from my machine which is still on High Sierra… so this definitively isn't only a Mojave bug 😢

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.13.6
BuildVersion:   17G3025
$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
$ uname -mrsv 
Darwin 17.7.0 Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT 2018; root:xnu-4570.71.13~1/RELEASE_X86_64 x86_64
$ stat /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h
16777220 8618694621 -rw-r--r-- 1 root wheel 0 10832 "Nov  7 10:03:18 2018" "Oct  7 04:47:09 2017" "Oct 31 21:53:27 2018" "Oct  7 04:47:09 2017" 4194304 0 0x80020 /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17/ruby/config.h


brew config

$ brew config
HOMEBREW_VERSION: 1.9.2-7-gbd09f93
ORIGIN: https://github.com/Homebrew/brew
HEAD: bd09f934fce29ce9554f452bd7f812dc65f14e4b
Last commit: 2 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: a6d37cf0856a1adaba4f7fb9ec509d4da9f12156
Core tap last commit: 3 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_LOGS: /Users/ohalligon/Library/Logs/Homebrew
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 10.0 build 1000
Git: 2.17.2 => /Applications/Xcode-10.1.app/Contents/Developer/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 10.0.2
macOS: 10.13.6-x86_64
CLT: 10.1.0.0.1.1539992718
Xcode: 10.1 => /Applications/Xcode-10.1.app/Contents/Developer


brew audit swiftgen

$ brew audit swiftgen                                    
Fetching gem metadata from https://rubygems.org/........
Using ast 2.4.0
Using bundler 2.0.1
Fetching json 2.1.0
Using docile 1.3.1
Using simplecov-html 0.10.2
Using tins 1.20.2
Using thor 0.19.4
Using diff-lcs 1.3
Fetching hpricot 0.8.6
Using jaro_winkler 1.5.2
Using mustache 1.1.0
Using parallel 1.12.1
Using powerpack 0.1.2
Using rainbow 3.0.0
Fetching rdiscount 2.2.0.1
Installing rdiscount 2.2.0.1 with native extensions
Installing json 2.1.0 with native extensions
Installing hpricot 0.8.6 with native extensions
Using rspec-support 3.8.0
Using ruby-progressbar 1.10.0
Using unicode-display_width 1.4.1
Using parser 2.5.3.0
Using term-ansicolor 1.7.0
Using parallel_tests 2.27.1
Using rspec-core 3.8.0
Using rspec-expectations 3.8.2
Using rspec-mocks 3.8.0
Using rubocop 0.61.1
Using rspec 3.8.0
Using rspec-its 1.2.0
Using rspec-retry 0.6.1
Using rspec-wait 0.0.9
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0/ext/json/ext/parser
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r ./siteconf20190129-87067-1ka29kg.rb extconf.rb
checking for rb_enc_raise() in ruby.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:535:in `block in try_link0'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:532:in `try_link0'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
    from extconf.rb:4:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/json-2.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.1.0 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/json-2.1.0/gem_make.out

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

In Gemfile:
  coveralls was resolved to 0.8.22, which depends on
    simplecov was resolved to 0.16.1, which depends on
      json


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6/ext/fast_xs
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r ./siteconf20190129-87067-etp61c.rb extconf.rb
checking for stdio.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:524:in `with_werror'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1091:in `block in have_header'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1090:in `have_header'
    from extconf.rb:2:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/hpricot-0.8.6/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/hpricot-0.8.6/gem_make.out

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

In Gemfile:
  ronn was resolved to 0.7.3, which depends on
    hpricot


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rdiscount-2.2.0.1/ext
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby -r ./siteconf20190129-87067-mpu8u7.rb extconf.rb
checking for random()... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/$(RUBY_BASE_NAME)
    --with-rdiscount-dir
    --without-rdiscount-dir
    --with-rdiscount-include
    --without-rdiscount-include=${rdiscount-dir}/include
    --with-rdiscount-lib
    --without-rdiscount-lib=${rdiscount-dir}/lib
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:535:in `block in try_link0'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:532:in `try_link0'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1051:in `block in have_func'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:320:in `open'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/mkmf.rb:1050:in `have_func'
    from extconf.rb:5:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/rdiscount-2.2.0.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rdiscount-2.2.0.1 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-9/2.3.0-static/rdiscount-2.2.0.1/gem_make.out

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

In Gemfile:
  ronn was resolved to 0.7.3, which depends on
    rdiscount


FWIW, I tried with HOMEBREW_FORCE_VENDOR_RUBY=1 brew audit swiftgen too, but got the same errors.

Note: Realizing Xcode 10.1 contained the MacOS10.14 SDK, I decided to switch my xcode-select from Xcode 10.1 to 9.4.1 (while still on the same machine with the same OS)… and the problem disappears šŸ¤” (after the brew audit I had to switch back to Xcode 10.1 to brew install swiftgen though as our formula require Xcode 10…)

This is a Mojave bug:

Homebrew/homebrew-cask#52775 (comment)

It's not just a Mojave bug - I experience the same issue in High Sierra 10.13.6

It’s technically Xcode 10 so yes it can affect High Sierra.

My current workaround:

rm -rf /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/
brew vendor-install ruby

Using brew vendor-install ruby alone is not enough.

@VonUniGE, thanks a lot. Only yours solution works and it is cross platform.. I got(Linuxbrew / Ubuntu 18.10).
The difference in Linux is rm -rf /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/.

rm -rf /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/
brew vendor-install ruby

@VonUniGE, I just tried that but brew audit (or brew style) keep complaining about the missing ruby/config.h file when trying to compile the JSON module. Did you set an environment variable to use the Vendor Ruby as well?

@mfriedenhagen I've had success with HOMEBREW_FORCE_VENDOR_RUBY=1

I now deleted /usr/local/* completely and reinstalled homebrew. The Mojave-bug (!Homebrew/homebrew-cask/issues/52775#issuecomment-444545063) is still there. So I will wait for a fix by Apple.

I have been digging into the install failures when running brew audit on my machine and this is what I have found:

RE: jaro_winkler (1.5.2)

creates a makefile that defines
hdrdir = /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18

but that directory does not exist. On my machine there is a universal-darwin17 directory in that location which contains the ruby/config.h file which is needed by the build. The build fails because it can't make that file and it isn't found where it is looking.

make: * No rule to make target
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18/ruby/config.h', needed by adj_matrix.o'. Stop.

RE: psych-3.1.0

It runs a command that again references the missing universal-darwin18 directory.

"xcrun clang -o conftest -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18 -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -g -Os -pipe -DHAVE_GCC_ATOMIC_BUILTINS conftest.c -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib -L. -lruby.2.3.0 -lpthread -ldl -lobjc "

which generates an error that causes the build to fail because it can't find the ruby/config.h again.

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found

include "ruby/config.h"

The same problem also causes the gem hpricot (0.8.6) to fail to install for the same reason, and also for unf_ext (0.0.7.5), and json (2.2.0).

I think this could be corrected by copying the universal-darwin17 directory into a new universal-darwin18 directory at the same location so the tools would find the missing file, but macOS won't let me create that directory (at least I can't convince it to do that. If anybody knows how to create a dir at System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18 and copy the files and directories from System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin17 into it, please let me know, all I get is "Operation not permitted").

@denniscote This is because of the System Integrity Protection of macOS.

This is because of the System Integrity Protection of macOS.

Yes, I figured that out with a little google searching, but I think I will leave it alone.

I simply wanted to update a Homebrew formula, but since the "brew bump-formula-pr" command does a "brew audit", and that fails because it can't install some gems, I can't do the update. I suspect other contributors may have run into the same problem which explains why the formula for ldc hasn't been update for two weeks since that project released the latest version.

@denniscote I've made a brew bump-formula-pr on ldc. Did you try my workaround?

rm -rf /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/
brew vendor-install ruby

@VonUniGE thanks for updating ldc

No, I didn't try your workaround. I had tried the "brew vendor-install ruby" earlier, but without the file deletions.

After that I started digging into the actual errors being reported and then discovered the incorrect system headers for ruby. It turns out there is a fix for that issue as described at https://stackoverflow.com/questions/53135863/macos-mojave-ruby-config-h-file-not-found. The answer provided by atamanroman https://stackoverflow.com/users/366299/atamanroman worked. It removes the CommandLineTools, and reinstalled them to replace a missing Package file, and then runs the package file to correct the System ruby headers by creating the missing universal-darwin18 directory. The commands are copied here for other that run into this issue:

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

After this all the gems installed correctly when I ran brew audit.

Unfortunately I got another error during "brew audit" as shown below.

Error: incompatible library version - /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/lib/jaro_winkler/jaro_winkler_ext.bundle
Please report this bug:
  https://docs.brew.sh/Troubleshooting
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/lib/jaro_winkler.rb:6:in `<top (required)>'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.65.0/lib/rubocop/string_util.rb:3:in `<top (required)>'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.65.0/lib/rubocop.rb:21:in `require_relative'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.65.0/lib/rubocop.rb:21:in `<top (required)>'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/style.rb:21:in `check_style_impl'
/usr/local/Homebrew/Library/Homebrew/style.rb:14:in `check_style_json'
/usr/local/Homebrew/Library/Homebrew/dev-cmd/audit.rb:112:in `audit'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'

I filed a bug report as requested, but I think this may be due to the previous "brew vendor-install ruby" that I did. I'm still not sure what that command does, and the brew help isn't that helpful.

Denniss-iMac:~ dennis$ brew help vendor-install
Usage: brew vendor-install [target]

Install Homebrew's portable Ruby.

Before and after running this command ruby reported the same version on my command line.

Denniss-iMac:~ dennis$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]

So, given that I am getting incompatible library version errors, I will try to delete the ruby/2.3.0 directory as you have suggested. Wish me luck.

So it turns out your workaround doesn't help. I get the same error about incompatible library version.

The vendor-install command seems to have installed the portable-ruby/2.3.7 where the gems installed by "brew audit" were built with the bundle/ruby/2.3.0.

More digging will be required.

Can I undo the "brew vendor-install ruby" command to uninstall the portable-ruby/2.3.7 version?

Thanks for updating ldc. That was my original goal. Now I would like to be able to do that in the future.

I now have two different versions of ruby installed.

Denniss-iMac:vendor dennis$ /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin13]
Denniss-iMac:vendor dennis$ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
Denniss-iMac:vendor dennis$ which ruby
/usr/bin/ruby
Denniss-iMac:vendor dennis$ ls -l /usr/bin/ruby
-r-xr-xr-x  1 root  wheel  52016 30 Nov 00:38 /usr/bin/ruby

I'm unsure if this is causing my incompatible library issue, but I would like to undo the "brew vendor-install ruby" command to remove the portable-ruby installation. Does anyone know how to do this safely? I tried looking in the vendor-install.sh script, but my bash scripting skills are a little rusty. I want to ensure I don't just delete files and leave some other variables set to point to the missing files. Any help would be appreciated.

creates a makefile that defines
hdrdir = /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18

but that directory does not exist.

@denniscote, that's exactly the bug I linked to in https://github.com/Homebrew/brew/issues/5561#issuecomment-455831630.

Hi Markus,

I saw your comment, and followed the link, but it didn’t seem to offer any guidance on how to resolve the issue.

I found a solution to the gem building problem on stackoverflow. Someone else had the same issue with ruby config.h missing, and they had been told to run the macOS_SDK_headers package to correct it. Like me, they couldn’t do that because the package file was missing. Finally, another user explained how to remove the command line tools, and reinstall the command line tools (which reinstalled the missing SDK package file), and then run the SDK package to install the missing config.h file.

After that all the gems required by "brew auditā€ were built, but I ran into another issue when it tries to use them. Now it complains about incompatible library versions.

Dennis Cote

On Mar 3, 2019, at 4:17 PM, Markus Reiter notifications@github.com wrote:

creates a makefile that defines
hdrdir = /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/include/ruby-2.3.0/universal-darwin18

but that directory does not exist.

@denniscote https://github.com/denniscote, that's exactly the bug I linked to in #5561 (comment) https://github.com/Homebrew/brew/issues/5561#issuecomment-455831630.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/Homebrew/brew/issues/5561#issuecomment-469075843, or mute the thread https://github.com/notifications/unsubscribe-auth/ACz1I6k1E06He6d1MqtsbqZw6cZHxJQPks5vTFgKgaJpZM4aJE9Y.

@denniscote, as far as I know there is no (proper, non-hacky) solution other than waiting for Apple to fix this. Also, using the additional headers package is discouraged if I remember correctly.

How can that be? Other people are able to update home-brew formulas, so they must be able to do a brew audit. This requires that the missing universal-darwin18/ruby/config.h file be installed. The SDK package does install that file, so I wouldn’t call it hacky. Perhaps they have that file installed by some other means, but it must be there for home-brew to work.

It seems like perhaps the last update to Xcode didn’t run this package to install these files, so that may well be what Apple does to fix it, if they do anything at all before the next Xcode release.

On Mar 4, 2019, at 1:13 AM, Markus Reiter notifications@github.com wrote:

@denniscote https://github.com/denniscote, as far as I know there is no (proper, non-hacky) solution other than waiting for Apple to fix this. Also, using the additional headers package is discouraged if I remember correctly.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/Homebrew/brew/issues/5561#issuecomment-469157383, or mute the thread https://github.com/notifications/unsubscribe-auth/ACz1I-__HkXLnN6WL__FwYtyySvw4WBtks5vTNWZgaJpZM4aJE9Y.

Success. :-)

I had to delete the portable-ruby directory and portable-ruby-version file at /usr/local/Homebrew/Library/Homebrew/vendor/ and then I deleted the entire directory at /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/

Then I ran the "brew audit " command. This causes all the ruby gems to be reinstalled which recreates the /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/ directory. This time the gems are built using the system ruby, so the incompatible library error is resolved.

brew doctor said that I had uncommitted modifications to homebrew, so I took its advice and ran the command

cd /usr/local/Homebrew/Library && git stash && git clean -d -f

Now brew doctor is happy, and I can audit a formula. My brew config now reports:

Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby

instead of the the portable-ruby as I had before.

I again have a working homebrew system.

@denniscote Your process worked me
I also delete several symlinks in
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/*
which were all pointed at 2.3.0

Running brew audit seems to first install all the ruby tools and then audit every formula in Library/Formulas one by one, which takes a very long time. Once it starts auditing it seems safe to hit Ctrl+C to abort. Or just do brew audit <formula>.

How did you uninstall / delete the portable ruby extra? I am not that tech savvy...thank you for the update

@ryanpropst1 I used the command line to remove the files.

cd /usr/local/Homebrew/Library/Homebrew/vendor/ to move into the vendor directory.

rm portable-ruby-version to delete the version file

rm -rf portable-ruby to delete the portable ruby installation. Be very careful with this command as it can cause a lot of damage if there is a typo.

rm -rf bundle/ruby/2.3.0 to delete all the ruby gems etc. Again, be careful. These files will be rebuilt when you run a brew audit command.

Finally, run brew audit <formula> where \

So I ended up uninstalling rvm and remove~/.gem then start over with vendor ruby...
If you use bash, check your ~/.profile, .bash_profile, .bashrc for $PATH related configurations.
Would be nice to check on gem env as well.

For what its worth, I've had almost the same error but at a different point and have found a fix. Mine failed on installing nokogiri for the 2nd time and this fixed the issue for me.
This is on an Ubuntu (16.04) docker container btw.

While running brew audit I got:

Error: incompatible library version - /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/lib/jaro_winkler/jaro_winkler_ext.bundle
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.2/lib/jaro_winkler.rb:6:in `<top (required)>'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.71.0/lib/rubocop/string_util.rb:3:in `<top (required)>'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.71.0/lib/rubocop.rb:17:in `require_relative'
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.71.0/lib/rubocop.rb:17:in `<top (required)>'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:39:in `require'
/usr/local/Homebrew/Library/Homebrew/style.rb:23:in `check_style_impl'
/usr/local/Homebrew/Library/Homebrew/style.rb:16:in `check_style_json'
/usr/local/Homebrew/Library/Homebrew/dev-cmd/audit.rb:114:in `audit'
/usr/local/Homebrew/Library/Homebrew/brew.rb:102:in `<main>'

Update: Uninstalling completely and installing again Homebrew solved the issue on my end.

None of the above suggestions have worked for me and I am still unable to run brew bump-formula-pr or brew audit I get the following:

$ brew audit mockserver
Fetching gem metadata from https://rubygems.org/.........
Using concurrent-ruby 1.1.5
Using minitest 5.11.3
Using thread_safe 0.3.6
Using ast 2.4.0
Using backports 3.15.0
Using bundler 2.0.2
Using connection_pool 2.2.2
Fetching json 2.2.0
Using docile 1.3.2
Using simplecov-html 0.10.2
Using tins 1.20.3
Using thor 0.20.3
Using diff-lcs 1.3
Fetching unf_ext 0.0.7.6
Fetching hpricot 0.8.6
Installing json 2.2.0 with native extensions
Installing hpricot 0.8.6 with native extensions
Installing unf_ext 0.0.7.6 with native extensions
Fetching jaro_winkler 1.5.3
Installing jaro_winkler 1.5.3 with native extensions
Using mime-types-data 3.2019.0331
Using net-http-digest_auth 1.4.1
Using mini_portile2 2.4.0
Using ntlm-http 0.1.1
Using webrobots 0.1.2
Using mustache 1.1.0
Using parallel 1.17.0
Using plist 3.5.0
Using rainbow 3.0.0
Fetching rdiscount 2.2.0.1
Installing rdiscount 2.2.0.1 with native extensions
Using rspec-support 3.8.2
Using ruby-progressbar 1.10.1
Using unicode-display_width 1.6.0
Using ruby-macho 2.2.0
Using i18n 1.6.0
Using tzinfo 1.2.5
Using net-http-persistent 3.0.1
Using parser 2.6.3.0
Using term-ansicolor 1.7.1
Using mime-types 3.2.2
Fetching nokogiri 1.10.3
Using parallel_tests 2.29.1
Using activesupport 5.2.3
Using rspec-core 3.8.1
Using rspec-expectations 3.8.4
Using rspec-mocks 3.8.1
Using rspec 3.8.0
Using rspec-its 1.3.0
Using rspec-retry 0.6.1
Installing nokogiri 1.10.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/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 ./siteconf20190622-72920-x0bi5z.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 /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/json-2.2.0 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/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.23, which depends on
    simplecov was resolved to 0.16.1, which depends on
      json


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/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 ./siteconf20190622-72920-1lipqfm.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 /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/unf_ext-0.0.7.6 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/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:
  mechanize was resolved to 2.7.6, which depends on
    http-cookie was resolved to 1.0.3, which depends on
      domain_name was resolved to 0.5.20180417, which depends on
        unf was resolved to 0.1.4, which depends on
          unf_ext


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6/ext/fast_xs
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190622-72920-tg6ds7.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 /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/hpricot-0.8.6 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/hpricot-0.8.6/gem_make.out

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

In Gemfile:
  ronn was resolved to 0.7.3, which depends on
    hpricot


Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.3/ext/jaro_winkler
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190622-72920-1xp24ee.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 /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/jaro_winkler-1.5.3 for inspection.
Results logged to /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/jaro_winkler-1.5.3/gem_make.out

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

In Gemfile:
  rubocop-performance was resolved to 1.4.0, which depends on
    rubocop was resolved to 0.71.0, which depends on
      jaro_winkler
Error: failed to run `/Users/jamesbloom/.gem/ruby/2.3.0/bin/bundle install`!

Even though each of the suggested commands in the error output I can execute without an issue.

I tried

rm -rf /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/
brew vendor-install ruby

but that changed the error to this:

$ brew bump-formula-pr --strict mockserver --url=https://oss.sonatype.org/content/repositories/releases/org/mock-server/mockserver-netty/5.6.0/mockserver-netty-5.6.0-brew-tar.tar --sha256=db8a4675a24796e25b3ba57044332c47eb0b9886eb8255551b0551cbc4e91b89
/usr/local/Homebrew/Library/Homebrew/load_path.rb:9:in `require': cannot load such file -- vendor/bundle/bundler/setup (LoadError)
    from /usr/local/Homebrew/Library/Homebrew/load_path.rb:9:in `<top (required)>'
    from /usr/local/Homebrew/Library/Homebrew/global.rb:10:in `require_relative'
    from /usr/local/Homebrew/Library/Homebrew/global.rb:10:in `<top (required)>'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
    from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'

Is there any update on when this may be resolved because it has prevented me from updating my formula for 6 months which doesn't seem ideal for a package management tool.

/usr/local/Homebrew/Library/Homebrew/load_path.rb:9:in `require': cannot load such file -- vendor/bundle/bundler/setup (LoadError)

This is a different error. If that doesn't exist your repository is missing files and you need to brew update or brew update-reset.

brew update-reset fixes the second error but the first error still exists

@jamesdbloom If mean you're still seeing the same issue as in this issue: that's why it's still open.

@MikeMcQuaid I mean even trying the working around that others have said resolve the issue is not resolving the problem on my computer

This solved it for me:

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

I don't have Xcode installed, I only had the CLI Tools.

This solved it for me:

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

I don't have Xcode installed, I only had the CLI Tools.

That just changes the error message I get to the following:

$ brew audit
Error: Error running `rubocop --format json --force-exclusion --parallel --only FormulaAudit --config /usr/local/Homebrew/Library/.rubocop_audit.yml /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula`
Ignoring hpricot-0.8.6 because its extensions are not built.  Try: gem pristine hpricot --version 0.8.6
Ignoring jaro_winkler-1.5.3 because its extensions are not built.  Try: gem pristine jaro_winkler --version 1.5.3
Ignoring json-2.2.0 because its extensions are not built.  Try: gem pristine json --version 2.2.0
Ignoring nokogiri-1.10.3 because its extensions are not built.  Try: gem pristine nokogiri --version 1.10.3
Ignoring rdiscount-2.2.0.1 because its extensions are not built.  Try: gem pristine rdiscount --version 2.2.0.1
Ignoring unf_ext-0.0.7.6 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.6
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- jaro_winkler (LoadError)
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.71.0/lib/rubocop/string_util.rb:3:in `<top (required)>'
    from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.71.0/lib/rubocop.rb:17:in `require_relative'
    from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.71.0/lib/rubocop.rb:17:in `<top (required)>'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.71.0/exe/rubocop:6:in `<top (required)>'
    from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/bin/rubocop:22:in `load'
    from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/bin/rubocop:22:in `<main>'

@jamesdbloom Please post on our Discourse instead; this issue isn't here to help individuals resolve their own particular errors. If you remove /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0 that may fix it for you but please refrain from posting more in this thread regardless, thanks.

@MikeMcQuaid I'm sorry but I thought as per the previous 47 similar comments it was helpful to provide extra information so that the source of the issue could be more clearly understood. Clearly my comment has upset you as you have not request any of the previous 47 identical comments to post on discus. I'm sorry if I have upset you.

@jamesdbloom You haven't upset me, thanks for the apology anyway though. The cause of the issue is understood, it's on Apple's end. Suggested workarounds here are the only additional useful contributions here, thanks.

Just for future reference if someone (like me) would encounter this issue:
installing zlib1g-dev package via apt fixes this.

@mcdado solution worked for me

This solved it for me:

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
$ open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

I don't have Xcode installed, I only had the CLI Tools.

I've dealt with a similar issue if I'm understanding correctly. I resolved it with the current 2.6.3 with:
ln -s /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/bin ~/.gem/ruby/2.6.0/bin

When the portable-ruby version was on 2.3.0 I think I only needed to run their gem update:
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/gem update --system

Has there been much reports of this now that we have updated vendored Ruby to 2.6.3 and therefore avoid using system Ruby on Mojave? It, in theory, shouldn't be possible now. If it's still trying to find 2.3 headers then it's clearly not using 2.6.3 properly.

I have not been able to reproduce this with brew's Ruby in the last few months on my Mojave install. That said, brew tests has been broken for me - though with a different error.

Yeh, gonna close this out. Comment here if you're still affected!

I’m still affected by this. I’ve been unable to run brew cask style/brew style for a while. Sometimes it self-heals intermittently for a few months, then it breaks again.

$ brew cask style claui/cask-games/gog-truberbrook

Command output

Ignoring bigdecimal-2.0.0 because its extensions are not built. Try: gem pristine bigdecimal --version 2.0.0
Ignoring bigdecimal-1.4.4 because its extensions are not built. Try: gem pristine bigdecimal --version 1.4.4
Ignoring bigdecimal-1.4.3 because its extensions are not built. Try: gem pristine bigdecimal --version 1.4.3
Ignoring bigdecimal-1.4.2 because its extensions are not built. Try: gem pristine bigdecimal --version 1.4.2
Ignoring date-3.0.0 because its extensions are not built. Try: gem pristine date --version 3.0.0
Ignoring date-2.0.0 because its extensions are not built. Try: gem pristine date --version 2.0.0
Ignoring dbm-1.1.0 because its extensions are not built. Try: gem pristine dbm --version 1.1.0
Ignoring etc-1.1.0 because its extensions are not built. Try: gem pristine etc --version 1.1.0
Ignoring gdbm-2.1.0 because its extensions are not built. Try: gem pristine gdbm --version 2.1.0
Ignoring io-console-0.5.6 because its extensions are not built. Try: gem pristine io-console --version 0.5.6
Ignoring io-console-0.5.5 because its extensions are not built. Try: gem pristine io-console --version 0.5.5
Ignoring io-console-0.5.4 because its extensions are not built. Try: gem pristine io-console --version 0.5.4
Ignoring io-console-0.5.3 because its extensions are not built. Try: gem pristine io-console --version 0.5.3
Ignoring io-console-0.5.2 because its extensions are not built. Try: gem pristine io-console --version 0.5.2
Ignoring io-console-0.5.0 because its extensions are not built. Try: gem pristine io-console --version 0.5.0
Ignoring io-console-0.4.9 because its extensions are not built. Try: gem pristine io-console --version 0.4.9
Ignoring io-console-0.4.8 because its extensions are not built. Try: gem pristine io-console --version 0.4.8
Ignoring json-2.3.0 because its extensions are not built. Try: gem pristine json --version 2.3.0
Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0
Ignoring stringio-0.1.0 because its extensions are not built. Try: gem pristine stringio --version 0.1.0
Ignoring strscan-1.0.3 because its extensions are not built. Try: gem pristine strscan --version 1.0.3
Ignoring zlib-1.1.0 because its extensions are not built. Try: gem pristine zlib --version 1.1.0
/Users/claudia/.gem/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated
Ignoring jaro_winkler-1.5.3 because its extensions are not built. Try: gem pristine jaro_winkler --version 1.5.3
Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0
Ignoring nokogiri-1.10.4 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.4
Fetching gem metadata from https://rubygems.org/.........
Using concurrent-ruby 1.1.6
Using minitest 5.14.0
Using thread_safe 0.3.6
Using zeitwerk 2.3.0
Using ast 2.4.0
Using bundler 1.17.3
Using connection_pool 2.2.2
Using json 2.3.0
Using docile 1.3.2
Using simplecov-html 0.10.2
Using sync 0.5.0
Using thor 1.0.1
Using diff-lcs 1.3
Fetching unf_ext 0.0.7.7
Using hpricot 0.8.6
Using jaro_winkler 1.5.4
Using mime-types-data 3.2019.1009
Using net-http-digest_auth 1.4.1
Using mini_portile2 2.4.0
Using ntlm-http 0.1.1
Using webrobots 0.1.2
Using mustache 1.1.1
Using parallel 1.19.1
Using plist 3.5.0
Using rainbow 3.0.0
Using rexml 3.2.4
Using rspec-support 3.9.2
Using ruby-progressbar 1.10.1
Using unicode-display_width 1.6.1
Using ruby-macho 2.2.0
Using i18n 1.8.2
Using tzinfo 1.2.6
Using simplecov 0.16.1
Using tins 1.24.1
Using rdiscount 2.2.0.1
Using net-http-persistent 3.1.0
Using mime-types 3.3.1
Fetching nokogiri 1.10.9
Using parallel_tests 2.32.0
Using parser 2.7.0.5
Using rspec-core 3.9.1
Using rspec-expectations 3.9.1
Using rspec-mocks 3.9.1
Using activesupport 6.0.2.2
Using term-ansicolor 1.7.1
Using ronn 0.7.3
Using rspec-retry 0.6.2
Using rubocop 0.80.1
Using rspec 3.9.0
Using rspec-its 1.3.0
Using coveralls 0.8.23
Using rubocop-performance 1.5.2
Using rubocop-rspec 1.38.1
Using rspec-wait 0.0.9
Installing unf_ext 0.0.7.7 with native extensions
Installing nokogiri 1.10.9 with native extensions
Using unf 0.1.4
Using domain_name 0.5.20190701
Using http-cookie 1.0.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/ext/nokogiri
/usr/local/var/rbenv/versions/2.6.5/bin/ruby -I /usr/local/var/rbenv/versions/2.6.5/lib/ruby/site_ruby/2.6.0 -r
./siteconf20200331-8731-13ypgbf.rb extconf.rb
checking if the C compiler accepts  -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.4.0
Ignoring jaro_winkler-1.5.3 because its extensions are not built. Try: gem pristine jaro_winkler --version 1.5.3
Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0
Ignoring nokogiri-1.10.4 because its extensions are not built. Try: gem pristine nokogiri --version 1.10.4
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:

Building Nokogiri with a packaged version of libxml2-2.9.10
with the following patches applied:
    - 0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
    - 0002-Remove-script-macro-support.patch
    - 0003-Update-entities-to-remove-handling-of-ssi.patch
    - 0004-libxml2.la-is-in-top_builddir.patch
    - 0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch

Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:

    gem install nokogiri -- --use-system-libraries
        [--with-xml2-config=/path/to/xml2-config]
        [--with-xslt-config=/path/to/xslt-config]

If you are using Bundler, tell it to use the option:

    bundle config build.nokogiri --use-system-libraries
    bundle install

Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.10.tar.gz into tmp/x86_64-apple-darwin18.7.0/ports/libxml2/2.9.10... OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch...
OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0002-Remove-script-macro-support.patch...
OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch...
OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch...
OK
Running git apply with
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch...
OK
Running 'configure' for libxml2 2.9.10... ERROR, review
'/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/ext/nokogiri/tmp/x86_64-apple-darwin18.7.0/ports/libxml2/2.9.10/configure.log'
to see what happened. Last lines are:
========================================================================
config.status: creating doc/examples/Makefile
config.status: creating doc/devhelp/Makefile
config.status: creating example/Makefile
config.status: creating python/Makefile
config.status: creating python/tests/Makefile
config.status: creating xstc/Makefile
config.status: creating include/libxml/xmlversion.h
config.status: creating libxml-2.0.pc
config.status: creating libxml-2.0-uninstalled.pc
config.status: creating libxml2-config.cmake
config.status: creating python/setup.py
config.status: creating xml2-config
config.status: creating config.h
config.status: executing depfiles commands
config.status: error: in
`/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/ext/nokogiri/tmp/x86_64-apple-darwin18.7.0/ports/libxml2/2.9.10/libxml2-2.9.10':
config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  Try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
See `config.log' for more details
========================================================================
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/var/rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME)
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:402:in `block
in execute': Failed to complete configure task (RuntimeError)
from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in
`chdir'
from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:373:in
`execute'
from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:110:in
`configure'
from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/mini_portile2-2.4.0/lib/mini_portile2/mini_portile.rb:153:in
`cook'
    from extconf.rb:365:in `block (2 levels) in process_recipe'
    from extconf.rb:257:in `block in chdir_for_build'
    from extconf.rb:256:in `chdir'
    from extconf.rb:256:in `chdir_for_build'
    from extconf.rb:364:in `block in process_recipe'
    from extconf.rb:262:in `tap'
    from extconf.rb:262:in `process_recipe'
    from extconf.rb:557:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/nokogiri-1.10.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9 for inspection.
Results logged to
/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/nokogiri-1.10.9/gem_make.out

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

In Gemfile:
  mechanize was resolved to 2.7.6, which depends on
    nokogiri
Error: failed to run `/Users/claudia/.gem/ruby/2.6.0/bin/bundle install`!

That's a bit different than the original error which was about finding Ruby headers ('ruby/config.h' file not found) which is well-known problem with Mojave's system gem.

For you, it looks like it is using the Ruby in rbenv. I'm not sure if that's the cause or not.

Is there a config.log (not configure.log) in or around /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/nokogiri-1.10.9/ext/nokogiri/tmp/x86_64-apple-darwin18.7.0/ports/libxml2/2.9.10/libxml2-2.9.10?

Does /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-18/2.6.0/nokogiri-1.10.9/mkmf.log provide anything that isn't already above?

For you, it looks like it is using the Ruby in rbenv. I'm not sure if that's the cause or not.

Yes, that will be the problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VagelisD picture VagelisD  Ā·  3Comments

fxcoudert picture fxcoudert  Ā·  3Comments

DomT4 picture DomT4  Ā·  3Comments

Rotonen picture Rotonen  Ā·  4Comments

mislav picture mislav  Ā·  3Comments