Forked from fairchild/fix_nokogiri_libxml_mismatch_on_mavericks.sh
Last active
August 29, 2015 14:08
-
-
Save joshuakfarrar/bbeb9e8f4a76f492ea44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# FIXME: | |
# WARNING: Nokogiri was built against LibXML version 2.9.0, but has dynamically loaded 2.8.0 | |
NOKOGIRIR_VERSION=${1:-1.6.1} | |
LIBXML_VERSION=${2:-2.9.1} | |
LIBXSLT_VERSION=${3:-1.1.28} | |
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 \ | |
--with-iconv-lib=/usr/local/opt/libiconv/lib | |
gem install nokogiri -v $NOKOGIRIR_VERSION -- | |
--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 | |
--with-iconv-lib=/usr/local/opt/libiconv/lib | |
# test that it worked | |
curl -s http://nokogiri.org | nokogiri -e'p $_.css("h1").length' | |
# modifed from earlier sources: | |
# https://gist.github.com/746966 | |
# https://gist.github.com/1226596 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment