Stephen Smith
Stephen Smith

Reputation: 377

Rails tutorial: "An error occurred while installing ffi (1.9.10), and Bundler cannot continue."

So I'm doing [this super basic Rails tutorial][1], and I'm stuck at this part:

bundle install --without production

It runs through a list of dependencies (?) but seems to get stuck on something calling ffi 1.9.10, where it gives me the following error message:

Using concurrent-ruby 1.0.0
Installing ffi 1.9.10 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/stephensmith/.rvm/rubies/ruby-2.2.3/bin/ruby -r ./siteconf20160101-33768-1kfzc9h.rb 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.

Provided configuration options:
    --with-opt-dir
    .
    .
    .
    --without-pkg-config
/Users/stephensmith/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/stephensmith/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
    .
    .
    .
    from /Users/stephensmith/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
    from extconf.rb:16:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/stephensmith/.rvm/gems/ruby-2.2.3@real_estate/gems/ffi-1.9.10 for inspection.
Results logged to /Users/stephensmith/.rvm/gems/ruby-2.2.3@real_estate/extensions/x86_64-darwin-14/2.2.0-static/ffi-1.9.10/gem_make.out
Using formatador 0.2.5
.
.
.
Using sprockets 3.5.2
An error occurred while installing ffi (1.9.10), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.10'` succeeds before bundling.

Any idea what's going on and how to fix it? I'm sure it's something simple, but I can't figure it out to continue with the tutorial. :-(

Upvotes: 1

Views: 4820

Answers (1)

lorefnon
lorefnon

Reputation: 13105

Given that your home directory is /Users/<username> I am guessing you are on a Mac. You need to install the Xcode command line tools as explained in this article

You can do this from the command line using xcode-select

Upvotes: 1

Related Questions