Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
eliminate the annoying nokogiri LibXML version mismatch on OSX
# WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.8.0
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew link libxml2
brew install libxslt
brew unlink libxslt
bundle config build.nokogiri \
--with-xml2-include=/usr/local/Cellar/libxml2/$LIBXML_VERSION/include/libxml2 \
--with-xml2-lib=/usr/local/Cellar/libxml2/$LIBXML_VERSION/lib \
--with-xslt-dir=/usr/local/Cellar/libxslt/$LIBXSLT_VERSION \
--with-iconv-include=/usr/local/opt/libiconv/include \
gem install nokogiri -v $NOKOGIRIR_VERSION --
# test that it worked
curl -s | nokogiri -e'p $_.css("h1").length'
# modifed from earlier sources:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.