Error installing Rails: Could not create custom Gem extension, missing libraries or headers,

I tried to get rails to work, but whatever I do it throws this error. So far I've tried to update everything, re-install homebrew and re-install ruby. RVM, however, will not install

sudo gem install rails

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking if the C compiler accepts ... *** 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.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in            `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block     in try_compile'
from    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:500:in    `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from extconf.rb:77:in `block in add_cflags'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:599:in `with_cflags'
from extconf.rb:76:in `add_cflags'
from extconf.rb:323:in `<main>'


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5/ext/nokogiri/gem_make.out

      

+3


source to share


3 answers


Here you got the error

"You have to install development tools first."

When trying to update a package, you will receive an error "You have to install development tools first."

on OSX,



If you already have Xcode installed, you can manually install the development tools via terminal:

 xcode-select --install

      

Your problem will be resolved.

+4


source


Your question does not specify your development environment. Mac? If so, have you installed the full Xcode from Apple? I see this line that says "Install development tools"



0


source


Just follow ... to help explain

it is possible that you are on mac and rails cannot find the correct compiler for the c headers.

just install xcode from app store / homebrew or go to terminal ...

$ xcode-select --install

complete the installation and negotiate licensing, etc., then ...

$ sudo gem install rails

0


source







All Articles