LoginSignup
5

More than 3 years have passed since last update.

【解決方法】Macで gem ffi の インストール (アップデート) に 失敗する

Last updated at Posted at 2020-03-21

問題

bundle updateを実行した際に、ffi のインストール(アップデート)に失敗した

$ bundle update

# ...()

Fetching ffi 1.12.2 (was 1.10.0)
Installing ffi 1.12.2 (was 1.10.0) with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

# ...()

extconf failed, exit code 1

Gem files will remain installed in /Users/xxxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/ffi-1.12.2 for inspection.
Results logged to /Users/xxxxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/ffi-1.12.2/gem_make.out

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

In Gemfile:
  middleman was resolved to 4.3.6, which depends on
    middleman-core was resolved to 4.3.6, which depends on
      listen was resolved to 3.0.8, which depends on
        rb-inotify was resolved to 0.10.1, which depends on
          ffi

試したこと

ffi をバージョン指定でインストール(アップデート)しようとしても失敗した

$ gem install ffi -v '1.12.2'

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

# ...()

解決方法

Xcode Command Line Tool をインストールした上で、ffi をインストール(アップデート)したら成功した

$ xcode-select --install

xcode-select: note: install requested for command line developer tools
$ gem install ffi -v '1.12.2'

Building native extensions. This could take a while...
Successfully installed ffi-1.12.2
Parsing documentation for ffi-1.12.2
Installing ri documentation for ffi-1.12.2
Done installing documentation for ffi after 41 seconds
1 gem installed

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
5