Skip to content

Instantly share code, notes, and snippets.

@mikbe
Last active July 10, 2016 04:07
Show Gist options
  • Save mikbe/90f78fb4b38c198c74505475d6230428 to your computer and use it in GitHub Desktop.
Save mikbe/90f78fb4b38c198c74505475d6230428 to your computer and use it in GitHub Desktop.
How to install Nokogiri
## Do this before doing bundle install
# Make sure you have Xcode installed with command line utilities.
# Install Home Brew (if you already have it installed update it):
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update --system
brew update
# If this is your first time installing Brew you may need these libraries:
brew install openssl libyaml readline
brew link readline
# Add the Home Brew path to your .bashrc/.profile file:
export PATH="/usr/local/sbin:$PATH"
# Close and reopen your terminal (source'ing can lead to extra long, redundant $PATH).
# Install libxml2, libxslt, and libiconv
brew install libxml2 libxslt
brew install homebrew/dupes/libiconv
# Close and reopen your terminal again so the libraries are seen
# Install nokogiri
sudo gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib
## To get `bundle install` to work do this:
bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"
bundle install
@jamesmichiemo
Copy link

Installed!

Thanks. I didn't know about the source'ing thing.

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