Ruby
Xcode
Capybara
capybara-webkit

XCode8.0にしたらcapybara-webkitがビルドできません(><)

More than 1 year has passed since last update.

こんなん出る。言われた通り /usr/bin/xcodebuild してみるも、XCodeのプロジェクトないしって怒られる。

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/path/to/project/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.11.1
/Users/me/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20161006-6647-1m1u5c7.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/me/.rbenv/versions/2.3.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 'qmake ' failed

extconf failed, exit code 1

Gem files will remain installed in
/Users/me/path/to/project/vendor/bundle/ruby/2.3.0/gems/capybara-webkit-1.11.1 for inspection.
Results logged to
/Users/me/path/to/project/vendor/bundle/ruby/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/capybara-webkit-1.11.1/gem_make.out

An error occurred while installing capybara-webkit (1.11.1), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.11.1'` succeeds before bundling.

本家に書いてある。
https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit#xcode-80

/usr/local/Cellar/qt55 的なディレクトリに入っている設定ファイルを書き換える(!)

わからなければ、qtのあるディレクトリで上記を実行するとファイル名がわかるけど遅い?
grep -rn /usr/bin/xcrun .

ので検索してもよい。

find /usr/local/Cellar -name "default_pre.prf"
/usr/local/Cellar/qt5/5.5.0/mkspecs/features/default_pre.prf
/usr/local/Cellar/qt5/5.5.0/mkspecs/features/mac/default_pre.prf
/usr/local/Cellar/qt5/5.5.0/mkspecs/features/win32/default_pre.prf
/usr/local/Cellar/qt5/5.5.0/mkspecs/macx-ios-clang/features/default_pre.prf

今回は以下だった。

/usr/local/Cellar/qt5/5.5.0/mkspecs/features/mac/default_pre.prf
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))): \

を下のように書き換える。

isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \

それからリビルドせぇと。動いたけど、動いたけどさぁ。