Increasingly Functional.
by Joshua Miller | on Twitter | on the web | on github

Error Building Capybara-Webkit - QMAKESPEC not defined

April 22nd 2016

Tagged: ruby

Building QT and capybara-webkit has always been at best an exercise in yak shaving and at worst an exercise in wizardry, prayer, and laptop damage. For the most part I have been free from problems with it for a while, but a new problem cropped up the most recent time I upgraded my Ruby version and bundled a project that included it:

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

    current directory: /Users/josh/.rvm/gems/ruby-2.3.0/gems/capybara-webkit-1.10.1
/Users/josh/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160422-60750-c7owvo.rb extconf.rb
QMAKESPEC has not been set, so configuration cannot be deduced.
Error processing project file: /Users/josh/.rvm/gems/ruby-2.3.0/gems/capybara-webkit-1.10.1/
*** 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:
Command 'qmake LIBS\ \+\=\ -L/usr/local/opt/libyaml/lib\ -L/usr/local/opt/readline/lib\ -L/usr/local/opt/libksba/lib\ -L/usr/local/opt/openssl/lib' failed

extconf failed, exit code 1

Gem files will remain installed in /Users/josh/.rvm/gems/ruby-2.3.0/gems/capybara-webkit-1.10.1 for inspection.
Results logged to /Users/josh/.rvm/gems/ruby-2.3.0/extensions/x86_64-darwin-15/2.3.0/capybara-webkit-1.10.1/gem_make.out

The error is caused by adding Anaconda to your PATH, which has its own qmake. Comment out this line in your ~/.bash_profile:

export PATH="~/anaconda/bin:$PATH"

And then open a new terminal window and re-bundle. Having found next to no clues on this Googling around, I hope this helps the next person suffering from the same issue.