Search code examples
ruby-on-railsinstallationruby-on-rails-5

extconf failed, exit code 1 error when installing [Ruby on Rails] 5 on OS X Yosemite 10.10.5


I'm trying to install Ruby on Rails v5 on OS X Yosemite 10.10.5, following the instructions on the rails site:

http://railsapps.github.io/installrubyonrails-mac.html

When I run this:

sudo gem install rails --version 5.0.0 --no-ri --no-rdoc

I get the error ERROR: Failed to build gem native extension. Here are parts of the output on my command line that might be useful:

current directory: /Users/me/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri

[...]


Running 'compile' for libxml2 2.9.4... ERROR, review '/Users/me/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-apple-da

rwin14.5.0/ports/libxml2/2.9.4/compile.log' to see what happened. Last lines are:

[...]

 1 error generated.
    make[2]: *** [xmlIO.lo] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    ========================================================================
    *** 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.

[...]

    To see why this extension failed to compile, please check the mkmf.log which can be found here:

      /Users/me/.rvm/rubies/ruby-2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-14/2.3.0/nokogiri-1.6.8/mkmf.log


    extconf failed, exit code 1

And here's part of the mkmf.log file:

"gcc -o conftest -I/Users/me/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/x86_64-darwin14 -I/Users/me/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0/ruby/backward -I/Users/me/.rvm/rubies/ruby-2.3.0/include/ruby-2.3.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens  -fno-common -pipe  conftest.c  -L. -L/Users/thanos/.rvm/rubies/ruby-2.3.0/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib     -lruby.2.3.0  -lpthread -ldl -lobjc  "
/Users/me/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:395: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

I have no idea what is going on :(. Can someone help?

RUBY VERSION: 2.3.0p0. RUBYGEMS VERSION: 2.5.1

xcode-select is successfully installed.

Thanks!


Solution

  • I solved it. The error had to do with nokogiri. I installed it separately with the -- --use-system-libraries parameter:

    gem install nokogiri -- --use-system-libraries
    

    and I managed afterwards to install rails without errors.