5
votes
bundle install  
Fetching gem metadata from https://rubygems.org/...........  
Fetching gem metadata from https://rubygems.org/..  
Resolving dependencies...  
Enter your password to install the bundled RubyGems to your system:   
Using addressable (2.3.8)   
Using sass (3.4.15)   
Using sassy-maps (0.4.0)   
Using breakpoint (2.5.0)   
Using chunky_png (1.3.4)   
Using coderay (1.1.0)   
Using multi_json (1.11.1)   
Using compass-core (1.0.3)   
Using compass-import-once (1.0.5)   
Using rb-fsevent (0.9.5)   
Installing ffi (1.9.9)   
Gem::Installer::ExtensionBuildError: 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 /Users/Moe/.bundler/tmp/8353/gems/ffi-1.9.9 for inspection.
Results logged to /Users/Moe/.bundler/tmp/8353/gems/ffi-1.9.9/ext/ffi_c/gem_make.out

An error occurred while installing ffi (1.9.9), and Bundler cannot continue. Make sure that gem install ffi -v '1.9.9' succeeds before bundling.

4
cannot complete bundle install stops and give me the previous errorMohamed Sobhy
Thanks God, I was able to solve the problem,,,Mohamed Sobhy

4 Answers

11
votes

Thanks God, I was able to solve the problem,,,

Turned out to be that one of the requirements is to have the "Command Line Tools" already installed on the system [using: Mac OSX 10.9] I was counting on that I already have "Xcode" installed, thats why I thought that "Command Line Tools" is bundled and installed with Xcode and it was but I just needed to configure "Xcode" properly....by doing the following:

1.start "Xcode"....

2.Go to "Preferences"

3.Select "Locations" tab

4.Command Line Tools: = select the version of "Xcode" that is already installed on the system. [Drop down menu]

5.Relaunch "Terminal"

6.Clear "Drush" cache

    drush cc drush

7.Run:

    gem install ffi -v '1.9.9'

and it was successful.

    bundle install

success also.

Please note: that I also did reinstall:

RVM:

    \curl -sSL https://get.rvm.io | bash -s stable

Bundler 1.10.5:

    gem install bundler 

Hope this would help.

2
votes

A likely culprit would be that Xcode path is wrong. Make sure there is valid Xcode then run this first.

sudo xcode-select --switch /Applications/Xcode.app
1
votes

This instruction helped me

$ cd /usr/local/lib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
$ sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.4.dylib

source: https://gist.github.com/Dreyer/0a0976f5606c0c963ab9a622f03ee26d

0
votes

I had a similar issue on Ubuntu 20.04.2 LTS

It was solved by running

sudo apt install libffi-dev
gem inst ffi

https://github.com/ffi/ffi/issues/608#issuecomment-363698071