83

I am new to ruby, but while trying to install capybara to run test on my system I get the following error. Im running OSX

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

/Users/joe/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb

Gem files will remain installed in /Users/joe/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.7.2 for inspection.
Results logged to /Users/joe/.rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.7.2/./gem_make.out

here are results from gem_make.out

/Users/joe/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
eiu165
  • 6,101
  • 10
  • 41
  • 59
  • 4
    Can you show what `gem_make.out` file says? I had a problem with installing `capybara-webkit` recently and what helped me was reinstalling `libqt4-dev` package on Ubuntu. Not sure what is equivalent on OSX, but may be you miss some qt dependencies too. – KL-7 Dec 03 '11 at 08:09
  • 1
    I am new to rails. I do not know what Qt is, I am looking for it now to install. thanks Marc – eiu165 Dec 03 '11 at 13:47

14 Answers14

96

Try installing libqt via homebrew.

$ brew install qt@5.5
Ryan McGeary
  • 235,892
  • 13
  • 95
  • 104
jefflunt
  • 33,527
  • 7
  • 88
  • 126
  • I'm still getting this same error after installing Qt. Qt itself seems to work fine, I can run the Qt Creator just fine. – Francois Jan 12 '12 at 20:55
  • @Francois - please post a separate question with your specific error messages, and reference this question as "not a solution for you" (in addition to your machine-specific details and why it's not working for you) so the community can properly address it. – jefflunt Jan 13 '12 at 00:07
  • @MichaelDurrant Post a separate question with your specific error messages, and reference this question as "not a solution" for you. – jefflunt Feb 20 '12 at 20:26
  • 1
    Why ask as a separate question? Would be nice to get all the information on this in one place. I to am having the trouble after installing qt – Abe Petrillo Aug 10 '12 at 09:54
  • For those people, who got any error, trying to install qt@5.5 - make sure, that you have checked all the NOTEs for your OS version, following the link. For example: `NOTE: If you got error fatal: reference is not a tree: 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97, use git fetch --unshallow to complete git history. NOTE: If you get Error: qt@5.5: unknown version :mountain_lion, comment line #25 in Formula/qt@5.5.rb` – Yurii Verbytskyi Nov 19 '19 at 09:42
92

Solution for Linux.

Ubuntu

sudo apt-get install libqt4-dev libqtwebkit-dev

Debian Stable

sudo apt-get install libqt4-dev

Fedora

yum install qt-webkit-devel

Fedora 16

yum install qtwebkit-devel

This works for me maybe it will be also helpful for somebody.

Mohit Jain
  • 43,139
  • 57
  • 169
  • 274
Suborx
  • 3,647
  • 2
  • 19
  • 30
  • `Package qtwebkit-devel-2.2.2-5.fc16.x86_64 already installed and latest version` :( – panzi Apr 11 '13 at 16:26
  • @panzi I have the same issue in Ubuntu 12.04 . Were you able to get a fix for it ? Would appreciate any tips.. – simha Jun 20 '13 at 11:39
  • 1
    @lnreddy I forgot how I fixed it. Sorry. Maybe it was something like running this before the setup: `export QMAKE=/usr/bin/qmake-qt4` – panzi Jun 20 '13 at 13:07
  • 1
    No problem , I found it ..My Ubuntu was missing the GNU c++ libraries..the g++ . So, I did `sudo apt-get install g++` and then it worked. – simha Jun 21 '13 at 10:44
  • Nowadays it looks like `sudo apt-get install libqt4-dev` works for Ubuntu too. – Dominic Sayers Dec 21 '14 at 11:32
  • 1
    Thanks so much. It resolved the issue that I'm encountering – huyhoang-vn Mar 28 '16 at 09:31
22
brew install qt@5.5

and then

gem install capybara-webkit -v '0.7.2'

-v 0.7.2 is to select version project is asking you to install. See that installing qt from http://developer.qt.nokia.com/wiki/Support_for_Mac_OS_X requires to set PATH variable.

Ryan McGeary
  • 235,892
  • 13
  • 95
  • 104
sites
  • 21,417
  • 17
  • 87
  • 146
10

Was having exactly this problem trying to install capybara-webdriver on CentOS 6 after installing QT.

Fixed the problem by adding the following to my PATH environment variable

/usr/lib64/qt4/bin/
Rob
  • 101
  • 1
  • 2
6

For OSX, I had to

brew install qt

and then

sudo gem install capybara-webkit -v '0.7.2'

without sudo it would error

robertjlooby
  • 7,160
  • 2
  • 33
  • 45
5

macOS Sierra 10.12, El Capitan 10.11 and Yosemite 10.10

Install with either homebrew or macports Homebrew

Qt 5.5 is the last version of Qt that capybara-webkit will support. The Qt project has dropped the WebKit bindings from binary releases in 5.6.

Install Qt 5.5 with homebrew:

brew install qt@5.5

The Homebrew formula for qt55 is keg only which means binaries like qmake will not be symlinked into your /usr/local/bin directory and therefore will not be available for capybara-webkit.

To force Homebrew to symlink those binaries into your /usr/local/bin directory you can run:

brew link --force qt55

After running this command you should get the following output:

$ which qmake
/usr/local/bin/qmake

Macports

Install qt5 with macports:

sudo port install qt5 qt5-qtwebkit # It's not qt5-mac anymore.

The default location for qt5's qmake is /opt/local/libexec/qt5/bin/qmake. If the qmake on path is different, you can indicate the correct one with QMAKE environment variable.

QMAKE=/opt/local/libexec/qt5/bin/qmake gem install capybara-webkit
Community
  • 1
  • 1
Moharnab Saikia
  • 487
  • 6
  • 10
3

For Debian & Ubuntu

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

You can find other ways to install Qt here

2

QT was the answer for me, thougtbot provide a comprehensive installation options here:

https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit

Generally depending on where you have home brew, this worked for me:

brew update
brew install qt
gem install capybara-webkit
Kingsley Ijomah
  • 3,273
  • 33
  • 25
1

On OSX Mavericks 10.9, qt5 does not install qmake. This post was the only thing that worked for me.

Step 1: Download Qt 5.2.0-beta-1-clang HERE.

Step 2: Install it and include the Src files.

Step 3: Symlink qmake into your /bin directory from the location where you installed Qt. The default location is in your home directory. Open a shell and do something like:

 ln -s /Path/to/where/you/installed/Qt5.2/5.2.0-beta1/clang_64/bin/qmake /usr/local/bin/qmake

Then gem install capybara-webkit.

Community
  • 1
  • 1
Marian Mosley
  • 31
  • 1
  • 2
  • For me, having installed qt5 with homebrew, it was: `ln -s /usr/local/Cellar/qt5/5.4.1/bin/qmake /usr/local/bin/qmake` – Magne Mar 06 '15 at 10:27
1

I am using Yosemite and following commands has fixed my issue.

brew install qt
brew linkapps qt
gem install capybara-webkit
mfq
  • 1,357
  • 13
  • 21
1

Here are the complete steps to install Capybara-webkit in all the OS

  1. Install QT - http://qt-project.org/downloads

    brew update brew install qt

  2. ln -s /usr/local/Cellar/qt5/5.4.1/bin/qmake /usr/local/bin/qmake

  3. sudo port install qt4-mac-devel

Reference: Capybara Installation

Aravin
  • 6,605
  • 5
  • 42
  • 58
  • Note that [link-only answers](http://meta.stackoverflow.com/tags/link-only-answers/info) are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference. – kleopatra Sep 16 '15 at 12:18
1

For fedora

yum install qt-webkit-devel
export QMAKE=/usr/bin/qmake-qt4
gem install capybara-webkit
raju gupta
  • 59
  • 1
  • 5
0

I was able to get qt and capybara-webkit installed and working on OS X. I had to install Xcode so the build for

gem install capybara-webkit

would finish.

I also set this in my environment

Capybara.javascript_driver = :webkit

brew install qt5 to get latest qt.

The docs for it say that it conflicts with qt4, so be sure to remove that first with

brew uninstall [old qt]

Then it needs to be symlinked with

brew link --force qt5

0

I've got error in my mac OS X 10.12, and this fixed the problem.

brew install qt5
brew link --force qt5
gem install capybara-webkit
Vibol
  • 1,158
  • 1
  • 9
  • 23
  • I'm getting the following error on the second step: ```% brew link --force qt5 Linking /usr/local/Cellar/qt/5.9.2... Error: Could not symlink Frameworks/Qt3DAnimation.framework /usr/local/Frameworks is not writable. ``` – Gerry Shaw Nov 19 '17 at 19:06