ERROR: Error installing capybara-webkit:

Ruby on-RailsRubyGemCapybaraCapybara Webkit

Ruby on-Rails Problem Overview


Any suggestions on how to fix?

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

        /home/durrantm/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
sh: qmake: not found


Gem files will remain installed in /home/durrantm/.rvm/gems/ruby-1.9.3-p194/gems/capybara-webkit-0.11.0 for inspection.
Results logged to /home/durrantm/.rvm/gems/ruby-1.9.3-p194/gems/capybara-webkit-0.11.0/./gem_make.out

Ruby on-Rails Solutions


Solution 1 - Ruby on-Rails

If you are in Ubuntu do

sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core libqt4-gui

If you are on Mac

brew install qt

and then

gem install capybara-webkit -v '0.11.0'

Solution 2 - Ruby on-Rails

For Ubuntu 16.04

sudo apt-get install qt-sdk

Followed by

gem install capybara-webkit -v '1.11.0' or replace with whatever version you want to install.

Solution 3 - Ruby on-Rails

You are probably missing the qt libraries. See the capybara-webkit wiki for instructions on installing them for your platform.

Solution 4 - Ruby on-Rails

brew install qt will only install (as of August 4, 2015) 4.8.6, which gives you this message.

WARNING: The next major version of capybara-webkit will require at least version 5.0 of Qt. You're using version 4.8.6.

Instead, if you do

brew install qt5
brew link --force qt5

you won't get that error.

Solution 5 - Ruby on-Rails

On El Capitan or Yosemite, you may need to do brew install qt55 according to the doc here.

Solution 6 - Ruby on-Rails

For Ubuntu 20.04 you can install qt5-default package

sudo apt-get install g++ qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x

Then install the gem with the required version:

gem install capybara-webkit -v '1.11.0'

Solution 7 - Ruby on-Rails

On fedora is a bit more complicated. I did the next which takes a while:

$ sudo dnf install make gcc-c++ gdb qt5*-devel qt-creator
$ export QMAKE=/usr/bin/qmake-qt5
$ gem install capybara-webkit

Then it worked!

See more info on capybara-webkit wiki

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMichael DurrantView Question on Stackoverflow
Solution 1 - Ruby on-RailssitesView Answer on Stackoverflow
Solution 2 - Ruby on-Railsujjayini duttaView Answer on Stackoverflow
Solution 3 - Ruby on-RailsTanzeeb KhaliliView Answer on Stackoverflow
Solution 4 - Ruby on-RailsWaynn LueView Answer on Stackoverflow
Solution 5 - Ruby on-RailsEthan ChenView Answer on Stackoverflow
Solution 6 - Ruby on-RailsAlexander SaratovcevView Answer on Stackoverflow
Solution 7 - Ruby on-RailsChiara AniView Answer on Stackoverflow