GCien
GCien

Reputation: 2349

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...

Upvotes: 0

Views: 1736

Answers (2)

lx00st
lx00st

Reputation: 1596

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

Upvotes: 4

Noel Frostpaw
Noel Frostpaw

Reputation: 4009

The problem could be your RVM.

Try either this command:

 rvm cleanup all
 rvm pkg uninstall libxml2
 rvm reinstall all --force

or upgrade/reinstall to the latest RVM installation.

-- To properly install the rails gem globally for a Ruby version:

rvm use <rubyversion>
gem install rails

example to use rails on ruby 2.1.5:

rvm use 2.1.5
gem install rails

Upvotes: 2

Related Questions