Skip to content

Instantly share code, notes, and snippets.

@jbbarth
Last active December 27, 2015 01:49
Show Gist options
  • Save jbbarth/7247978 to your computer and use it in GitHub Desktop.
Save jbbarth/7247978 to your computer and use it in GitHub Desktop.
Fix nokogiri warnings about varying libxml2 versions and related deface defects on MacOSX
cd /path/to/your/project
#install libxml2 v2.8.0 instead of 2.9+ and libxslt 1.1.26 instead of 1.1.28
brew unlink libxml2
brew unlink libxslt
cd $(brew --prefix)
git checkout $(brew versions libxml2 | grep 2.8.0 | sed -e 's/.*checkout//')
git checkout $(brew versions libxslt | grep 1.1.26 | sed -e 's/.*checkout//')
brew install libxml2
brew install libxslt
brew switch libxml2 2.8.0
brew switch libxslt 1.1.26
brew link libxml2 --force
brew link libxslt --force
#FOR REDMINE:
#now back to redmine dir
cd -
gem uninstall -a -I -x nokogiri
bundle config build.nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2/ --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib/ --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28
bundle install
#check versions loaded by nokogiri
rails runner 'puts "nokogiri: #{Nokogiri::LIBXML_VERSION} / #{Nokogiri::LIBXML_PARSER_VERSION}"'
#should display: "nokogiri: 2.8.0 / 20800"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment