How to install Nokogiri on Mac OS Sierra 10.12

I'm having problems installing Nokogiri (1.6.8.1) on Mac OS Sierra 10.12.

I tried using brew install libxml2 libxslt and then refer to the installation directories using command line options, but that didn't help.

+70
ruby nokogiri
Oct 14 '16 at 8:52
source share
8 answers

Open Xcode and in the Xcode β†’ Preferences menu update your command line tools (Xcode 8.0).

Then do:

 bundle config build.nokogiri --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2 bundle install 

or simply:

 gem install nokogiri -v 1.6.8.1 -- --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2 
+172
Oct 14 '16 at 8:52
source share

A simpler solution is to run:

 xcode-select --install gem install nokogiri 

Refresh

For gem install nokogiri -v '1.6.6.2' -- --use-system-libraries I use gem install nokogiri -v '1.6.6.2' -- --use-system-libraries

+121
Oct 24 '16 at 8:01
source share

Try installing libxml2 first with Homebrew.

 brew install libxml2 

Then if the installation with the package

 bundle config build.nokogiri --use-system-libraries \ --with-xml2-include=$(brew --prefix libxml2)/include/libxml2 bundle install 

If installed directly using gem

 gem install nokogiri -- --use-system-libraries \ --with-xml2-include=$(brew --prefix libxml2)/include/libxml2 
+41
Jan 6 '17 at 4:56 on
source share

It could be a duplicate. Gem install nokogiri -v '1.6.8.1' fails ... the last accepted answer was to do:

brew unlink xz; bundle install; brew link xz

Re-binding xz might not be necessary ... if, for example, you only have this dependency due to the_silver_searcher (which is directly related to the asymmetric library).

+11
Oct 21 '16 at 12:55
source share
 gem update --system xcode-select --install brew unlink xz gem install nokogiri -v '1.6.8.1' brew link xz 

If the above steps did not solve the problem, running brew doctor and cleaning up any unpaired header files also worked for me.

+11
Nov 28 '16 at 17:22
source share

Similar to yui answer and using Nokogiri:

 brew unlink xz gem install nokogiri brew link xz 

http://www.nokogiri.org/tutorials/installing_nokogiri.html#mac_os_x

This worked for 1.7.0.1

+10
Jan 06 '17 at 1:41 on
source share

If you previously installed nokogiri using bundler with bundle config build.nokogiri --use-system-libraries this option will still be there. If in the meantime you decide to configure Xcode (as suggested as the main installation method when installing nokogiri), then you can try to remove this fra from bundle config --delete build.nokogiri and try bundle install again.

0
Jul 06 '18 at 11:43
source share

For the intermediary

gem install nokogiri -v '1.8.2' - --use-system-library = true --with-xml2-include = / Applications / Xcode.app / Content / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10 .13.sdk / usr / include / libxml2 /

0
May 6 '19 at 6:00 AM- AM
source share



All Articles