Getting nokogiri to install was failing for me. I'm using bundler and needed nokogiri. Gem is trying to compile it and failing on libxml2.
At first I tried using the libxml from brew, that that didn't work, so specified where to find XCode's version of libxml in my bundle config.
BUNDLE_BUILD__NOKOGIRI: "--use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2"