LoginSignup
2
1

More than 3 years have passed since last update.

Mojave 10.14.6(18G95)でcapybara-webkitがbundle installできなかった話

Posted at

Mojaveになってからbundle installがうまく行かない

自身の環境

Mojave Version 10.14.6(18G95)
X-code Version 10.3 (10G8)

bundle installして出てきたエラーとその考察

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
​
    /Users/akito/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151023-29612-1v0p8sd.rb extconf.rb
QMAKESPEC has not been set, so configuration cannot be deduced.
Error processing project file: /Users/akito/git/project/vendor/bundle/gems/capybara-webkit-1.7.1/webkit_server.pro
*** 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/akito/.rbenv/versions/2.2.3/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 'qmake ' failed
​
extconf failed, exit code 1
​
Gem files will remain installed in /Users/akito/git/project/vendor/bundle/gems/capybara-webkit-1.7.1 for inspection.
Results logged to /Users/akito/git/project/vendor/bundle/extensions/x86_64-darwin-15/2.2.0-static/capybara-webkit-1.7.1/gem_make.out
An error occurred while installing capybara-webkit (1.7.1), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.7.1'` succeeds before bundling.

長いエラーが出てしまいますが、この手のオプションを示すエラーが出ている場合、大抵はこのオプションを示した後に解決の鍵になるワードがあるそうです。ですので、今回は下記がキーワードになります。

Command 'qmake ' failed

qmakeというコマンドが必要のようです。capybara-webkitの公式に行ってみます。

Installing Qt and compiling capybara webkit

丁寧にインストールのやり方が載っていますが、Mojaveのインストール方法はここに載っているものではうまくいきませんでした。何が間違っているかというと、このREADMEにあるQt5.5のイメージファイルをインストールしてくるリンクです。これをインストールして、bundle installしても

Command '/Users/user-name/Qt5.5.0/5.5/clang_64/bin/qmake ' failed

と出てきてしまい、成功しません。

解決策

QT Downloads

上記のサイトにあるqt-opensource-mac-x64-clang-5.5.0.dmgをダウンロードしてきてください。
セットアップに関してはGUIでポチポチ進められます。

今度はシェルにこのパスを読ませてください。筆者はzshを利用しているので、.zshrcに書きました。

export PATH="/Users/user-name/Qt5.5.0/5.5/clang_64/bin:$PATH"

.zshrcを読み込ませてください。

$ source ~/.zshrc

そして、QMAKEまでのパスを指定した状態で、capybara-webkitを直接インストールします。

$ sudo QMAKE="$HOME/Qt5.5.0/5.5/clang_64/bin/qmake" gem install capybara-webkit

成功しました!

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1