ERROR: Error installing vagrant: ERROR: Failed to build gem native extension - vagrant

I'm trying to install vagrant on MacOS (Lion). But it keeps failing.
What happens...
sudo gem update --system
sudo gem install vagrant
Building native extensions. This could take a while... ERROR: Error
installing vagrant: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb mkmf.rb can't find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in
/Library/Ruby/Gems/1.8/gems/ffi-1.0.11 for inspection. Results logged
to /Library/Ruby/Gems/1.8/gems/ffi-1.0.11/ext/ffi_c/gem_make.out
I have XCode installed (installed it this morning from the AppStore).
Any ideas how I can fix this?

The problem was that XCode 4.3 doesn't in command line tools by default (not sure if this is the first version that doesn't do this). Installing them got it working.
Command Line Tools can be installed by going to Preferences > Downloads > Components.

I'm not sure why your build was failing, but starting with Vagrant 1.0 (not released yet, but RCs are out), the preferred installation method will be packages, so you can just download a pkg for Mac and install, even without XCode installed: http://downloads.vagrantup.com/

Related

Error Installing Jekyll in Cygwin

So I attempted to install Jekyll on Windows through Cygwin and I encountered an error when I tried to install Jekyll through Cygwin. Here is the output.
Michael#X556UAK: ~$ gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /c/Users/Michael/.gem/ruby/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/usr/bin/ruby.exe -r ./siteconf20171011-7692-lgoixq.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /c/Users/Michael/.gem/ruby/2.3.0/gems/ffi- 1.9.18 for inspection.
Results logged to /c/Users/Michael/.gem/ruby/2.3.0/extensions/x86_64-cygwin/2.3.0/ffi-1.9.18/gem_make.out
I conducted some research online and I wasn't able to find a solution. I tried running Cygwin as an administrator and I still got that error message.
What can I do to fix this issue?
I had the same issue when installing Jekyll and Ruby in the Windows 10 Bash Linux Subsystem. It turned out, that the development package from Ruby was missing. I had to install it first:
sudo apt-get install ruby2.4-dev
In my case. Try to install the dev package in Cygwin package manager, in your case its version 2.3.
Andy
For the record, I encountered the same problem Michael did, and installing the ruby-devel package (using the Cygwin Setup installer) solved my problem. A missing *-devel Cygwin package is a common cause of errors about missing header files.

Jekyll with Ruby 2.3 on macOS 10.13 (HighSierra)

When I run $ jekyllor $ jekyll serve it raises the following error:
-bash: /usr/local/bin/jekyll: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory
I checked /System/Library/Frameworks/Ruby.framework/Versions/ and Version 2.0 does not exist. It turns out that on the same day I updated on HighSierra, Version 2.3 was installed.
I think Jekyll still looks for Version 2.0. So how can I tell Jekyll to use Ruby 2.3?
Edit:
When I uninstall and then install jekyll, it fails:
$ gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.18/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20171111-1004-fgop80.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.9.18 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/ffi-1.9.18/gem_make.out
Solution:
I googled can't find header files for ruby and it turned out that "Command Line Tools for Xcode" must be installed which you can download here: https://developer.apple.com/download/more/
However, I have macOS 10.13 and there is no command line tools for Xcode 8.x (which was the latest version I could install). That's why I searched for Xcode in the Mac App Store and installed Xcode 9. Once, it was installed, a window popped up that said "git requires command line tools. Do you want to install it?". I clicked install and still failed to run $gem install jekyll.
Then I tried $ brew doctor. There were some warnings which I fixed one by one and finally I'm able to run $ gem install jekyll.
I had the same issue. I just uninstalled jekyll
gem uninstall jekyll
and then installed it again.
gem install jekyll
Then it worked again.

Installing Compass on Mac OS X 10.12 Sierra

I am working on two separate machines; one that has Compass installed on it from when the machine was running OS X Yosemite (happy with this one); and one that I am trying to install Compass on that is currently running OS X Sierra (Not so happy about this one).
I had some trouble back in the day with gem install compass while running Yosemite and after searching Stack it seemed that the issue was a user could no longer write to the specified directory they were trying to when running this command. Some suggested using running sudo gem install compass (and this is how I got my first machine running Compass).
With this second machine I run sudo gem install compass and received the following error:
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.14 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.14/ext/ffi_c/gem_make.out
I am not very familiar with CLI. Why am I unable to install Compass on Mac OS X Sierra 10.12?
It looks like you missing the devel headers.
I had a similar issue with another gem (ffi) and I solved it installing XCode (v. 8.0).
Once downloaded make sure to open Xcode, some components are only installed after the first time you open it. After that try again to run gem install.
I installed Homebrew as part of one solution I was trying, which installs the Xcode Command Line tools. (I had intended to use Homebrew to install Ruby and Compass in a different directory because I was initially getting permissions errors when using $ sudo gem install compass.) Once I installed Homebrew, I was able to use $ gem install compass successfully.

ERROR: Error installing json: ERROR: Failed to build gem native extension

I am trying to install gem json and getting error for json.
I'm running:
Windows 8.1 (64 bit)
Ruby: ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
gem: 1.8.2
D:\GIT\calabash>gem install json -v '1.8.3'
Building native extensions. This could take a while...
The system cannot find the path specified.
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.8.3/ext/json/ext/generator/gem_make.out
D:\GIT\calabash>
Its a late response, but may it helps someone else. to install json '1.8.3' it requires packages 'libgmp3-dev'.
Use following steps:
sudo apt-get install libgmp3-dev
gem install json -v '1.8.3'
For anyone who has this issue on Sierra, I solved the problem through this thread: https://teamtreehouse.com/community/installing-ruby-on-mac-got-error
Coles notes version is that after updating to most recent version of XCode, I had to accept the terms for the XCode command line tools. See them/agree to them by running:
gcc --version
After I did that, everything installed as expected.
To help you here are some steps to follow in order to install your gem locally:
Download json-1.8.3.
Place the downloaded gem into a folder called gems
Open the Ruby cmd console (click on start button, select Ruby then select "Start command prompt with Ruby")
cd to the gems folder. If the path to the folder is C:\Desktop\gems, write the command: cd C:\Desktop\gems then click "Enter".
To install the gem run the following command:
gem install --local json-1.8.3.gem
I tried it and it worked for me, hopefully it will work for you.
Result:
Second way:
Include the whole path of the gem in the command:
gem install --local C:\Users\kedarl\Desktop\T\json-1.8.2.gem
For me here is the result. (This time with the json-1.8.2.gem):
I've solved this by installing Command Line Tools Xcode of the version I have. I hope this helps someone else.
If you installed Rails through RailsInstaller, try this -
https://gist.github.com/luislavena/f064211759ee0f806c88
It's a pretty common bug for RailsInstaller currently.

Rubymine 6.0.2, unable to debug

On my new OSX Mavericks install, I wanted to give Rubymine a try and just can't get the debugger working (although i managed to get it working on Windows 7 with IntelliJ and the ruby plugin).
Here's what I did (XCode and commandline tools already installed):
homebrew install ruby
gem update --system
Then I installed Rubymine and opened some of my projects. Upon starting the debugger, rubymine tries to install dependencies:
Failed to Install Gems. Following gems were not installed:
/Applications/RubyMine.app/rb/gems/ruby-debug-ide-0.4.22.gem: Error
installing ruby-debug-ide-0.4.22.gem: ERROR: Failed to build gem
native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
mkrf_conf.rb Installing base gem You don't have write permissions for
the /Library/Ruby/Gems/2.0.0 directory.
/Library/Ruby/Site/2.0.0/rubygems/installer.rb:620:in
verify_gem_home'
/Library/Ruby/Site/2.0.0/rubygems/installer.rb:740:in
pre_install_checks'
/Library/Ruby/Site/2.0.0/rubygems/installer.rb:213:in install'
/Library/Ruby/Site/2.0.0/rubygems/request_set.rb:136:inblock in
install' /Library/Ruby/Site/2.0.0/rubygems/request_set.rb:120:in
each' /Library/Ruby/Site/2.0.0/rubygems/request_set.rb:120:in
install'
/Library/Ruby/Site/2.0.0/rubygems/dependency_installer.rb:389:in
install' mkrf_conf.rb:34:inrescue in ' mkrf_conf.rb:27:in ` ' rake
failed, exit code 1 Gem files will remain installed in /Volumes/OSX
DATA/Users/freakazoid/.gem/ruby/2.0.0/gems/ruby-debug-ide-0.4.22 for
inspection. Results logged to /Volumes/OSX
DATA/Users/freakazoid/.gem/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/ruby-debug-ide-0.4.22/gem_make.out
/Applications/RubyMine.app/rb/gems/debase-0.0.9.gem: Error installing
debase-0.0.9.gem: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
extconf.rb
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby:
invalid option -D (-h will show valid options) (RuntimeError) extconf
failed, exit code 1 Gem files will remain installed in /Volumes/OSX
DATA/Users/freakazoid/.gem/ruby/2.0.0/gems/debase-0.0.9 for
inspection. Results logged to /Volumes/OSX
DATA/Users/freakazoid/.gem/ruby/2.0.0/extensions/universal-darwin-13/2.0.0/debase-0.0.9/gem_make.out
I can without problems do a
gem install debugger
on my osx terminal
Any help out there?
You need to get the source files since they aren't included.
gem install debugger-ruby_core_source
Then try again.
Also, since I've found this sometimes isn't set correctly in Rubymine, in the menu bar go to "Rubymine" -> "preferences" -> "Ruby SDK and Gems" and make sure it is pointed to the version of Ruby you are expecting.
Thanks Beartech, you pointed me to the right direction:
Rubymine was looking for ruby in "/Library/..../ruby" and homebrew of course had ruby installed to another location. I had to edit my rubymine settings and point the ruby sdk to homebrew's ruby. Then i had to restart rubymine in order to successfully use the new sdk location. (I had previousl not restartet rubymine ...)

Resources