Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
4
Help us understand the problem. What is going on with this article?

More than 1 year has passed since last update.

@NaokiIshimura

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

問題

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
4
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
4
Help us understand the problem. What is going on with this article?