Help us understand the problem. What is going on with this article?

El Capitan で library not found for -lgmp が発生する時の対処法

More than 3 years have passed since last update.

OS を El Capitan にアップデートしてから遭遇した問題のメモ。

library not found for -lgmp が発生

gem をインストールしようとしたら下記のようなエラーが発生。

guest1-107:app t-fujiki$ bundle install
Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Using i18n 0.7.0
Installing json 1.8.3 with native extensions

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

    /Users/t-fujiki/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151005-20477-hk2ir0.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
linking shared-object json/ext/generator.bundle
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [generator.bundle] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/t-fujiki/Development/iOS/iosApp/vendor/bundler/ruby/2.2.0/gems/json-1.8.3 for inspection.
Results logged to /Users/t-fujiki/Development/iOS/iosApp/vendor/bundler/ruby/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/json-1.8.3/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.3'` succeeds before bundling.

対処法

コマンドラインツールをインストールしたら成功するようになりました。

xcode-select --install
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