Nokogiri is notorious for being annoying to install because it has a couple dependencies. In 1.6, they tried to add the dependencies to the package so they it would just work. I was out of luck on that.
I found a solution that did work.
gem install nokogiri -v '18.104.22.168' -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2
It uses the system libraries and specifies where to find libxml2.