1

I'm trying to setup environtment for ruby project. But when I run 'bundle', I have error during installing 'fii' gem:


    Installing ffi (1.8.1) 
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/bin/ruby extconf.rb 
    checking for ffi.h... *** 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.

    /Users/bmalets/.rvm/rubies/ruby-1.9.3-p448/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.

    Gem files will remain installed in /Users/bmalets/.rvm/gems/ruby-1.9.3-p448@api2/gems/ffi-1.8.1 for inspection.
    Results logged to /Users/bmalets/.rvm/gems/ruby-1.9.3-p448@api2/gems/ffi-1.8.1/ext/ffi_c/gem_make.out

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


My environment:

  • OS_X 10.8.4

  • ruby 1.9.3p448

  • Xcode 4.6.3

  • libffi-3.0.13

Please, help me to fix it.

bmalets
  • 3,207
  • 7
  • 35
  • 64

1 Answers1

4

Make sure that you have installed Apple Xcode and Command Line Tools (look at this screenshot):

https://developer.apple.com/technologies/tools/

After that, don't forget to install libffi.

1) if you are using homebrew

brew install libffi

2) if you are using macport

sudo port install libffi
bmalets
  • 3,207
  • 7
  • 35
  • 64
gvalmon
  • 938
  • 5
  • 18
  • That's a very common error. I use macports, they are far more flexible than brew and work like a charm if you come from a unix background. If not though, it's better to use brew. – patm Jul 21 '13 at 18:04
  • I have already installed 'libffi' and Xcode. Unfortunately, I can't understand what's the cause of problem((. – bmalets Jul 21 '13 at 18:19
  • @bmalets May be these steps will help: http://stackoverflow.com/a/10610951/595120 – gvalmon Jul 21 '13 at 18:22
  • Try to do this steps. Now have the same problem with atomic gem :D – bmalets Jul 21 '13 at 18:27
  • Did you installed command line tools for xcode? it's accessible via components tab in XCode. – gvalmon Jul 21 '13 at 18:31