Summary
bundle config --local build.nokogiri --use-system-libraries
bundle install --path vendor/bundle
macOS Mojave (10.14.2) + Ruby2.5.3 + Nokogiri1.8.5
bundle config --local build.nokogiri --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2
bundle install --path vendor/bundle
macOS Mojave (10.14.3 Beta) + Ruby2.6.0 + Nokogiri1.9.1
bundle config --local build.nokogiri --use-system-libraries --with-iconv-dir="$(brew --prefix libiconv)" --with-xml2-config="$(brew --prefix libxml2)/bin/xml2-config" --with-xslt-config="$(brew --prefix libxslt)/bin/xslt-config"
bundle install --path vendor/bundle
Reference
GitHub - sparklemotion/nokogiri - Issues #1801https://github.com/sparklemotion/nokogiri/issues/1801