Mac OS 10.14 Mojave + qt5.5 + gem capybara-webkit

As described on the capybara-webkit wiki, capybara-webkit depends on Qt 5.5. "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."

To install Qt 5.5 follow the instructions from the wiki. For Mojave, the instructions are the following.

brew update
cd $( brew --prefix )/Homebrew/Library/Taps/homebrew/homebrew-core
git checkout 9ba3d6ef8891e5c15dbdc9333f857b13711d4e97 Formula/[email protected]
brew install [email protected]
echo 'export PATH="$(brew --prefix [email protected])/bin:$PATH"' >> ~/.bashrc

You can confirm this step worked by running:

$ which qmake
/usr/local/opt/[email protected]/bin/qmake

Next, you need to install Xcode 9.4. Xcode 10 is not compatible with Qt 5.5. Xcode 9.4 can be downloaded from the Apple developer portal. This is a 4GB download and takes about 30 minutes to download and install. You can verify it's correctly installed by running the following:

$ /usr/bin/xcodebuild -version
Xcode 9.4.1
Build version 9F2000

If this doesn't work, it may be because you have only the Command Line Tools installed instead of Xcode, in which case you should make sure you downloaded the right version of Xcode. Or the Xcode folder may set incorrectly. If so, you can fix this using xcode-select, which will specifiy the folder in which xcodebuild runs:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

When Xcode is finally installed, locate it in your Applications folder, open it, and agree to the license. Then try reinstalling capybara-webkit.


Disclaimer: I came up with the above answer from compiling multiple questions and answers and trying to remember the order in which I ran commands on my local machine. I may have accidentally omitted some steps.


Here's what worked for me, found here:

  • Keep your xcode v10 installed
  • Manually download and install Qt 5.5 from their website
  • Add Qt's bin path to your PATH environment variable by adding this to your .bashrc, .zshrc or any other shell configuration that you have: (make sure to replace /Applications/Qt/5.5/clang_64/bin with your Qt bin path)
export PATH="/Applications/Qt/5.5/clang_64/bin:$PATH" # Add Qt bin to path for capybara webkit to work
  • Run gem install capybara-webkit

I think my problem was with xcrun. For fix I did :

  • sudo chown root:wheel /Applications/Xcode.app
  • sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
  • cd /Applications/Xcode.app/Contents/Developer/usr/bin/
  • sudo ln -s xcodebuild xcrun

And it work (y) !