Newbie here. I've searched for other similar questions on the site but still wasn't able to solve the problem. I've installed Ruby 2.0.0 and RubyGem 2.0.3, but when I'm trying to install Rails 4.0.0 I got:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
*** 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
--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=/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:431:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:516:in `try_link0'
from /Users/yuanhunglo/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/mkmf.rb:814:in `try_run'
from extconf.rb:22:in `<main>'
Gem files will remain installed in /Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.10 for inspection.
Results logged to /Users/yuanhunglo/.rvm/gems/ruby-2.0.0-p0/gems/atomic-1.1.10/ext/gem_make.out
I tried to install Rails by
gem install rails --version 4.0.0
I'm not sure if there's something wrong with the set up or if I still need to install something. Thanks in advance for your help.
It seems you're using OSX.
This error happens when you can't compile some extensions, in this case due to the lack of a compiler ("You have to install development tools first"). Open App Store, download XCode and, after installing it, click on "XCode" on the menu, go to Preferences -> Downloads -> Components and download "Command Line Tools".
Related
I've been trying to get rails working but whatever I do it comes up with this error. So far I've tried to update everything, re install homebrew, and re install ruby. RVM however will not installl
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
Here you got the error
"You have to install development tools first."
Incase, while trying to update a bundle, you get an error "You have to install development tools first." on OSX ,
If you already have Xcode installed, you can still manually install the development tools via terminal:
xcode-select --install
Your problem will be solved.
Your question fails to specify your development environment. Mac? If so, Have you installed the full XCode from Apple? I see that line that says "install development tools"
Just a follow up ... to help explain
it may be that you are on a mac and rails cannot find the right compiler for c headers.
just install xcode from apps store / homebrew or go to terminal ...
$ xcode-select --install
complete the installation and agree on the licensing etc, then ...
$ sudo gem install rails
I keep getting the following error. I have rvm 1.25.17 (stable), ruby 2.1.0p0 revision 44422. Also, I checked my Xcode install and I think it's up to date (3.2 in /Developer and 5.0.2 in /Applications). At some point, an error told me that my Xcode might not be installed. I'm getting back into programming after a long break and am at a loss. Just trying to get setup on some Ruby on Rails...
Fetching: atomic-1.1.14.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/ecualombian/.rvm/rubies/ruby-2.1.0/bin/ruby extconf.rb
*** 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=/Users/ecualombian/.rvm/rubies/ruby-2.1.0/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/lib
/Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
from /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/mkmf.rb:840:in `try_run'
from extconf.rb:26:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/gems/atomic-1.1.14 for inspection.
Results logged to /Users/ecualombian/.rvm/rubies/ruby-2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-12/2.1.0-static/atomic-1.1.14/gem_make.out
From XCode 5.0.1 onwards, you can install commandline tools from the terminal. Here's the command, please run this on your Terminal:
xcode-select --install
Once it's installed, try installing the gems again.
Basically atomic gem expects you to have developer tools like gcc 4.2 which you can install view brew or simply install XCode command like tools, reinstall ruby via rvm and then install rails.
You are probably missing command line tools for Xcode, that are required for gcc and make. Install the same from Xcode-> Preferences-> Downloads, or from the command line with xcode-select --install, and then retry installing Rails.
I downloaded xcode, command line tools, home brew, rvm, and ruby, but when I use the command sudo gem install rails I get an error message. Not sure what to do any help would be great, I want to install rails on my new mac.
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /Users/cheatermoves/.rvm/gems/ruby-2.0.0-p247/gems/atomic-1.1.14/test/test_atomic.rb
marshalls-MacBook-Air:~ cheatermoves$ sudo gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/cheatermoves/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** 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=/Users/cheatermoves/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/Users/cheatermoves/.rvm/rubies/ruby-2.0.0-p247/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 /Users/cheatermoves/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from /Users/cheatermoves/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run'
from extconf.rb:26:in `<main>'
You probably don't want to be using sudo with RVM... Try just:
gem install rails
sudo gcc --version
When you have done this accept user agreement from xcode! (this is what fixed it for me.)
I've been doing quite a bit of research on this issue the last week or so but haven't found a solution that works for me, it's very frustrating. Hopefully somebody can point me in the right direction. Here's the error I recieve
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Name/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
* 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=/Users/Name/.rvm/rubies/ruby-2.0.0-p247/bin/ruby --with-atomic_reference-dir --without-atomic_reference-dir --with-atomic_reference-include --without-atomic_reference-include=${atomic_reference-dir}/include --with-atomic_reference-lib --without-atomic_reference-lib=${atomic_reference-dir}/ /Users/Name/.rvm/rubies/ruby-2.0.0-p247/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 /Users/Name/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:intry_link0' from /Users/Name/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in try_run' from extconf.rb:24:in'
Gem files will remain installed in /Users/Name/.rvm/gems/ruby-2.0.0-p247#swi----ense/gems/atomic-1.1.12 for inspection. Results logged to /Users/Name/.rvm/gems/ruby-2.0.0-p247#sw-----nse/gems/atomic-1.1.12/ext/gem_make.out
An error occurred while installing atomic (1.1.12), and Bundler cannot continue. Make sure that gem install atomic -v '1.1.12' succeeds before bundling.
This should work:
gem install atomic -V
And then:
gem install rails -V
The -V is for Verbose. You'll see what happen.
It worked for me on a Linux box, when gem update didn't.
You also need to have the latest rubygem / bundler.
This happened to me because I didn't have the right version of XCode Developer Tools for OS X Mavericks. Then when I tried to update it, it said it wasn't available from the Software Update server. Details here.
I've been trying to find a solution to this for a few days now and no luck. If anyone has been successful installing the libv8 gem for REE 1.8.7 on ML, could you please let me know the process you followed?
I have both the XCode LLVM compiler as well as the kennethreitz GCC package for 10.7+ v2 installed.
The output when trying to install with native extensions is:
Building native extensions. This could take a while...
ERROR: Error installing libv8:
ERROR: Failed to build gem native extension.
/Users/XXXXX/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby extconf.rb
*** 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=/Users/XXXXX/.rvm/rubies/ree-1.8.7-2012.02/bin/ruby
extconf.rb:13: uninitialized constant Gem (NameError)
Checking for Python...
Gem files will remain installed in /Users/XXXXX/.rvm/gems/ree-1.8.7-2012.02/gems/libv8-3.3.10.4 for inspection.
Results logged to /Users/XXXXX/.rvm/gems/ree-1.8.7-2012.02/gems/libv8-3.3.10.4/ext/libv8/gem_make.out
(The results logged are the exact same as the error).
This worked for me.
RUBYOPT=-rrubygems gem install therubyracer
I was able to successfully install the libv8 gem on Mountain Lion on a freshly installed ree-1.8.7. I believe the issue you're seeing stems from the GCC version being used.
As is now described in the osx-gcc-installer's README you should switch from Kenneth Reitz's LLVM-version of GCC to the GCC 4.2 that is available via Homebrew or Macports.
Homebrew instructions:
http://coderwall.com/p/dtbuqg
MacPorts instructions:
http://coderwall.com/p/pagj2w
Note that you will want to set the CC path and establish the necessary symlink as described in those articles.