Search code examples
ruby-on-railsosx-maverickslibxml2

Problems with libxml2 when installing Ruby on Rails on OSX Mavericks


I'm having a problem installing Ruby on Rails in my terminal.

Has anyone else encountered the following error in the terminal:

checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** 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.

I'm using the standard bash:

$ gem install rails

How would I go about fixing this? I've tried a few things here on stack exchange but nothing so far has worked...

Using $ brew list in the terminal yields:

Michaels-iMac:~ iMacHome$ brew list
autoconf    libksba     libxslt     pkg-config
automake    libtool     libyaml     readline
libgpg-error    libxml2     openssl
Michaels-iMac:~ iMacHome$

It seems to be there...


Solution

  • assuming you have Xcode installed try this

    gem install rails -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.‌platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 --use-system-libraries