Gem installation error: You have to install development tools first

you have to install development tools first. ubuntu
ruby you have to install development tools first windows
error: failed to build gem native extension.
install ruby on rails
could not create makefile due to some reason, probably lack of necessary libraries and/or headers.
gem install ruby
error: error installing nokogiri: error: failed to build gem native extension
ruby development tools

I tried installing the gem 'sinatra-websocket', but when I ran gem install sinatra-websocket, I got this error...

ERROR: Failed to build gem native extension

... along with ...

C:/Ruby193/bin/ruby.exe extconf.rb
checking for main() in -lc... *** 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=C:/Ruby193/bin/ruby
    --with-thin_parser-dir
    --without-thin_parser-dir
    --with-thin_parser-include
    --without-thin_parser-include=${thin_parser-dir}/include
    --with-thin_parser-lib
    --without-thin_parser-lib=${thin_parser-dir}/lib
    --with-clib
    --without-clib
C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:845:in `block in have_library'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from C:/Ruby193/lib/ruby/1.9.1/mkmf.rb:840:in `have_library'
    from extconf.rb:4:in `<main>'

Here's what the mkmf file in C:\Ruby193\lib\ruby\gems\1.9.1\gems\thin-1.6.3\ext\thin_parser looks like:

"gcc -o conftest -IC:/Ruby193/include/ruby-1.9.1/i386-mingw32 -IC:/Ruby193/include/ruby-1.9.1/ruby/backward -IC:/Ruby193/include/ruby-1.9.1 -I. -DFD_SETSIZE=2048  -DFD_SETSIZE=2048  -O3 -fno-omit-frame-pointer -g -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration conftest.c  -L. -LC:/Ruby193/lib -L.   -march=i486   -lmsvcrt-ruby191  -lshell32 -lws2_32 -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

I'm using Windows 7.

Why am I getting the error? There's a line stating "could not create Makefile...", but is that relevant?

Have you run:

xcode-select --install

To install the Xcode Developer tools?

Error: "You have to install development tools first." · Issue #1727 , gem install cocoapods Building native extensions. This could take a while ERROR: Error installing cocoapods: ERROR: Failed to build gem  February 27, 2018 Windows Leave a comment. Questions: In my project, I have a large container with a handler for taps. Inside this container, I also have a button. My goal is to handle all taps on the background container UNLESS the user click

edit: rubyinstaller now provides installs with the devkit included. These are labelled on the download page.

Sounds like you're missing the devtools for ruby.

You can get them here: http://rubyinstaller.org/downloads/ just scroll down to "Development Kit".

Download and extract that to anywhere you want. Open up the folder in command prompt and run ruby dk.rb init. This will create a config file detailing your ruby installations. Check this config file before continuing to confirm the paths to your ruby installation are correct.

Now run ruby dk.rb install. This will install the development kit.

Restart command prompt, and try to install the gem again.

gem install fails: ERROR: Failed to build gem native extension , ERROR: Error installing travis: ERROR: Failed to build gem native extension. (​RuntimeError) You have to install development tools first. from  "gem install ruby-oci8" is failing on my AWS amzn-ami-hvm-2016.09 linux VMs. Easily reproducable on a fresh VM with nothing but the instant-client unzipped, the paths set, and ruby-devel installed.

I was having this issue on MacOS Mojave(10.14.1). Installing latest ruby via Homebrew and setting some env variables solved it for me:

export PATH="/usr/local/opt/ruby/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"

'gem install' help please - Ruby, take a while… ERROR: Error installing RedCloth: ERROR: Failed to bui… (​RuntimeError) You have to install development tools first. from  Used rbenv to install ruby 2.1.2 'rbenv install 2.1.2', configured local version with 'rbenv local 2.1.2', rehash (I'm using zsh) and reran 'sudo gem pristine --all' without any errors. Xcode select is set to xcode 6 beta 7.

If you're on Mac OS 10.14 (Mojave) try

cd  /Library/Developer/CommandLineTools/Packages/;
open macOS_SDK_headers_for_macOS_10.14.pkg

Credit to Roy Huang Reference: https://stackoverflow.com/a/55732339/1598551

Bundler installation fails on Ubuntu Xenial, Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: (RuntimeError) You have to install development tools first. from  This will create a config file detailing your ruby installations. Check this config file before continuing to confirm the paths to your ruby installation are correct. Now run ruby dk.rb install. This will install the development kit. Restart command prompt, and try to install the gem again.

If you're on Mac and recently upgraded your Xcode tools, run the following commands:

sudo xcode-select --install
sudo xcodebuild -license

You Have To Install Development Tools First, You Have To Install Development Tools First ERROR: Error installing adhearsion: ERROR: Failed to build gem native extension. I had trouble with the rbzmq gem, and fixed this by ensuring I did not have gcc-4.2 in my path and then re-installing ruby via "rbenv install 2.1.2" I had gcc-4.2 in my path, probably from a bad idea (or a previous OS X install) so I had to fist remove gcc.

Installing Nokogiri, dnf install -y make gcc rpm-build ruby-devel zlib-devel gem install nokogiri First​, make sure you have the latest version of RubyGems and xcode commandline tools: gem A more recent error mentions an undeclared identifier LZMA_OK :. Hi guys, Travis CLI does not seem to be willing to install on my machine (I'm using this docker image as my container). root@ff8ac5453dbc:~# gem install travis Building native extensions.

Problem using "gem install rails -v 5.2.3" on XUbuntu 18.04, Command 'rails' not found, but can be installed with: extconf.rb failed *** (​RuntimeError) You have to install development tools first. from  There's a bug in the current version of Bundler that's embedded in Vagrant that can cause Ruby's built-in gems to be fetched as dependencies during a gem install. On machines where a gcc build toolchain is not available, this causes an error building the native extensions of the json gem.

Error installing Ruby on Rails (Arch Linux), You have to install development tools first. As the error message mentioned, you can look at the file /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.​0  If you're using RubyInstaller to install Ruby, then you can install Nokogiri's pre-compiled gem to avoid having to install a compiler toolchain: gem install nokogiri Note that gem will download and use a version of the gem appropriate for your system and architecture (e.g., x64-mingw32 , x86-mingw32 , etc.).

Comments
  • The mkmf.log file can be found under the gem's installation directory.
  • @siaw23 I've added the contents of the file
  • Have you got a C compiler installed?
  • The one I've used in the past is Mingw. From this you can try make -v and gcc -v to check. You might try installing the Ruby dev kit
  • Check this answer out, it's detailed and better than any advice I could give. stackoverflow.com/a/11484346/335847
  • I don't think the "development tools" being referenced in the error has anything to do with xcode, especially considering this is on Windows.
  • The original question definitely stated Windows, but regardless - this helped me on a Mac!
  • Just what I was missing on OSX El Capitan.
  • 'xcode-select' is not recognized as an internal or external command, operable program or batch file.
  • (On Mac OSx Mojave) After running xcode-select --install, close and re-open the terminal. Then, run sudo xcodebuild -license, follow the instructions and finally accept the license agreement. In my experiment, this was the solution to solve the problem.
  • If you installed ruby via brew, you can get those env variables with brew info ruby
  • This answer fixed my issue when trying to use the Sass compiler after the recent OSX update
  • I was able to execute your steps without error on Mojave, but they didn't help me with the error "You have to install development tools first".
  • I was able to execute your steps without error on Mojave, but they didn't help me with the error "You have to install development tools first".