Search code examples
ruby-on-railsrubygemsbundlebundlercapybara-webkit

El Capitan: Can't install capybara-webkit


I couldn't bundle since there was an error occurred while installing capybara-webkit (1.11.1). So I tried gem install capybara-webkit -v '1.11.1', but it returned en error: Failed to build gem native extension. I'm not even sure what does it mean.

The entire output would be:

Building native extensions.  This could take a while...
ERROR:  Error installing capybara-webkit:
    ERROR: Failed to build gem native extension.

    current directory: ...

*** 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-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=...
    --with-gl-dir
    --without-gl-dir
    --with-gl-include
    --without-gl-include=${gl-dir}/include
    --with-gl-lib
    --without-gl-lib=${gl-dir}/lib
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
Command ' ' not available

extconf failed, exit code 1

Gem files will remain installed in .../capybara-webkit-1.11.1 for inspection.
Results logged to .../capybara-webkit-1.11.1/gem_make.out

Does anyone know how to handle this issue? Thank you in advance!


Solution

  • The answer posted by @raghu will work with Qt5.5 which is the last version officially supported by the developers of capybara-webkit. Another option is to make homebrew install qt-webkit with the current version of qt and then build capybara-webkit against that. Start by uninstalling qt from homebrew if you've already installed it (brew uninstall qt), then

    brew install qt --with-qtwebkit
    

    and go do something else for a while as it compiles from source. Once it's finished try installing the capybara-webkit gem again.