Nokogiri error when running bundle install Nokogiri error when running bundle install ruby-on-rails ruby-on-rails

Nokogiri error when running bundle install


I'm using Mac OSX (El Capitan) and it appears to be related to Xcode Developer Tools. I ran xcode-select --install in my working directory, then reran bundle install command and it all worked fine after that ^^.

Hope this could help someone.


I ran into this error and this is what worked for me:

bundle config build.nokogiri --use-system-librariesbundle install

The problem was with libxml:

libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.


Turned out I was using the default system Ruby (and thus installing all the gems there in /Library/Ruby/Gems) even though rbenv points to ruby-1.9.3 so that's why Nokogiri was complaining.

Fixed this by adding this to $PATH, so rbenv loads before the system ruby:

export PATH="$HOME/.rbenv/bin:$PATH"