0

I've been trying to install Rails on my computer today but I can't seem to figure it out. After using

gem install rails

I get a lot of errors I can't seem to decipher. They seem to be related to Nokogiri, but after 3-4 hours of seemingly random installations and "fixes" I am nowhere.

I tried using

gem install nokogiri -v 1.6.5 -- --use-system-libraries

and got

ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

/Users/xlforloser/.rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20150103-18446-1ac5ew1.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-      future... no
Building nokogiri using system libraries.
libxml2 version 2.6.21 or later is required!

If I only run gem install rails, I got

ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

Running 'compile' for libxml2 2.9.2... ERROR, review '/Users/xlforloser/.rvm/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-apple-darwin14.0.0/ports/libxml2/2.9.2/compile.log' to see what happened.

Please help!

the Tin Man
  • 158,662
  • 42
  • 215
  • 303

1 Answers1

1

You have two hints about the problem:

  • libxml2 version 2.6.21 or later is required!
  • ...review '/Users/xlforloser/.rvm/rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.5/ext/nokogiri/tmp/x86_64-apple-darwin14.0.0/ports/libxml2/2.9.2/compile.log' to see what happened.

To fix these:

  • Read what is in compile.log and search for information about what it says.
  • Read through the "Related" answers on the right-side of this page. Read them ALL before doing something. Too many times people try one thing, then another, then another, and end up making the problem worse because not everyone's situation applies to them.
  • You can use Homebrew to install a current version of libxml2.
the Tin Man
  • 158,662
  • 42
  • 215
  • 303