Cassidy
Cassidy

Reputation: 3428

Unable to install Rails due to libxml2 not detected properly

I'm trying to install Rails on my Mac (Yosemite). I've gone through several SO questions, reinstalling libxml2 with Homebrew, and with RVM, and updating Ruby, etc. and nothing has worked so far. My libxml2 version is 2.9.2.

ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

What should I try next?

Upvotes: 1

Views: 58

Answers (1)

K M Rakibul Islam
K M Rakibul Islam

Reputation: 34338

You have issues with nokogiri building.

Try the following steps. This should work for Yosemite:

brew install libxml2

bundle config build.nokogiri "--use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2"

bundle install

Upvotes: 1

Related Questions