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

StackOverflow https://stackoverflow.com/questions/9378284

  •  28-10-2019
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top