LoginSignup
12

More than 5 years have passed since last update.

mac os Mojave にアップグレードしたら bundle install が失敗する事象を解決した

Last updated at Posted at 2018-10-05

環境

  • MacBook Pro (Retina, 13-inch, Mid 2014)
  • MacOS mojave(10.14)
  • ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
  • rails 4.2.1

状況

Railsで動いているプロジェクトをMacにインストールしていたが、Mojaveにアップデートした途端、bundle installが動かないことに...

bundle installで出てきたエラー

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

/Users/kabushikikaisharijobu/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20181005-1426-8xywg0.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... no
creating extconf.h
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="

(中略)

make: *** ["/Users/kabushikikaisharijobu/rejob-v2/vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10/ext/ffi_c"/libffi-x86_64/.libs/libffi_convenience.a] Error 2

make failed, exit code 2

Gem files will remain installed in /Users/kabushikikaisharijobu/rejob-v2/vendor/bundle/ruby/2.2.0/gems/ffi-1.9.10 for inspection.
Results logged to /Users/kabushikikaisharijobu/rejob-v2/vendor/bundle/ruby/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/ffi-1.9.10/gem_make.out

An error occurred while installing ffi (1.9.10), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.10' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  webdriver-user-agent was resolved to 7.4, which depends on
    selenium-webdriver was resolved to 3.1.0, which depends on
      childprocess was resolved to 0.6.1, which depends on
        ffi

対応法

command-line
open /Library/Developer/CommandLineTools/Packages/

上記、openコマンドにより、command-line-toolのパッケージフォルダを開く。
その後、macOS_SDK_headers_for_macOS_10.14.pkgが存在するので、クリックしてインストール。

参照元:
https://blog.driftingruby.com/updated-to-mojave/

その後、bundle installを実行。 無事、完了した。

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
12