I was trying to install ffi on my mac and got the following error:
sudo gem install ffi -v '1.0.7'
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
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.7 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/ffi-1.0.7/ext/ffi_c/gem_make.out
Here is what you need to do resolve the issue:
- Install xcode
- Install the "Command Line Tools" from xcode -> Preferences -> Downloads -> Components
Now you will be able to install the gem and build its native extensions on your mac.
An important UPDATE from my good friend Oscar Reiken:
Oscar Rieken5:52 PM (edited)