Search code examples
ruby-on-railsmacoscapybara-webkitthoughtbot

Gem Capybara-webkit On macOS High Sierra 10.13 Webkit gem


Appologies if this appears like a duplicate question but "Stumped" is the word.

Thank the Lord for this place. (And the contributors)

I have followed all instructions from the Stackoverflow questions relating to this. I have spent countless hours both at work and my evenings. I have successfully installed and used this gem on Ubuntu/Debian machines in the past including headlessly on a Google cloud based Debian instance.

I have followed the instructions from the site below using brew. https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#macos-sierra-1012

$  brew install [email protected] --with-qtwebkit

results in

Warning: qt: this formula has no --with-qtwebkit option so it will be ignored!
==> Downloading https://homebrew.bintray.com/bottles/[email protected]_1.high_sierra.bottle.tar.gz
######################################################################## 100.0%

$ which qmake

gives

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

Then I run

$ brew link --force [email protected]

Then I run

~$ QMAKE=/usr/local/opt/[email protected]/bin/qmake gem install capybara-webkit -v '1.14.0'

I have successfully installed Xcode via the App Store.

But try as I might.....

~$ QMAKE=/usr/local/opt/[email protected]/bin/qmake gem install capybara-webkit -v '1.14.0'

Only results in the following output.

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

current directory: /Users/matthew/.rbenv/versions/2.4.1/gemsets/video-store/gems/capybara-webkit-1.14.0
/Users/matthewrentz/.rbenv/versions/2.4.1/bin/ruby -r ./siteconf20180504-16518-1q3n536.rb extconf.rb
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
*** 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=/Users/matthew/.rbenv/versions/2.4.1/bin/$(RUBY_BASE_NAME)
    --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 '/usr/local/opt/[email protected]/bin/qmake ' failed

extconf failed, exit code 1

Gem files will remain installed in /Users/matthew/.rbenv/versions/2.4.1/gemsets/video-store/gems/capybara-webkit-1.14.0 for inspection.
Results logged to /Users/matthew/.rbenv/versions/2.4.1/gemsets/video-store/extensions/x86_64-darwin-17/2.4.0-static/capybara-webkit-1.14.0/gem_make.out

I have run the suggestion contained in the above output

$ /usr/bin/xcodebuild

Which gives

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

$ echo $PATH

gives /Users/matthew/.rbenv/bin:/Users/matthew/.rbenv/shims:/usr/local/opt/[email protected]/bin:/Users/matthew/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

As for the line....

Check the mkmf.log file for more details.

I'd love to if I had any idea where to find it. I suppose it exists on the filesystem somewhere?

Any help is much appreciated. From my reputation points I'm still pretty green. I just can't proceed without being able to get this working.

Thanks to all of the contributors to this place.

Cheers


Solution

  • No way!!

    I'm finally able to contribute to SO. (Even if I am only answering my own question)

    (And even if it is only to say that I found the answer while on GitHub. There's an issue that Addresses this.) (And it probably means that this is a duplicate of the same question)(please don't hurt my reputation)(Which seems to happen to me quite regularly)

    Turns out the issue is to do with the line

    Project ERROR: Xcode not set up properly.
    

    from the above output.

    Thankyou https://github.com/vassilevsky

    https://github.com/thoughtbot/capybara-webkit/issues/948

    The offending line being (Drum roll)

    @vassilevsky it looks like you just need to accept the Xcode license. You can do that with:

    sudo xcode-select -r
    

    Tada!

    Building native extensions. This could take a while... Successfully installed capybara-webkit-1.14.0 Parsing documentation for capybara-webkit-1.14.0 Installing ri documentation for capybara-webkit-1.14.0 Done installing documentation for capybara-webkit after 1 seconds 1 gem installed