Skip to content

Instantly share code, notes, and snippets.

@cbetta
Created November 25, 2011 17:00
Show Gist options
  • Save cbetta/1393974 to your computer and use it in GitHub Desktop.
Save cbetta/1393974 to your computer and use it in GitHub Desktop.
How to fix a segfault for Nokogiri on Ruby 1.8.7 on OS X
# First install libxslt and libxml2 using Homebrew
brew install libxslt
brew install libxml2
# Now rebuild nokogiri with these new libs (make sure to update version numbers if your homebrew installed a different version)
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
@caius
Copy link

caius commented Feb 6, 2012

What I suggested (--with-xml2-dir) doesn't work, as the include directory of libxml2 as installed by homebrew is nested, not just include/. I also had to install libiconv and supply --with-libiconv-dir for it to both compile and link against libxml2 2.7.8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment