Forked from devpuppy/nokogiri libxml homebrew lion
Last active
November 4, 2015 02:28
-
-
Save fairchild/11118184 to your computer and use it in GitHub Desktop.
eliminate the annoying nokogiri LibXML version mismatch on OSX
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