LoginSignup
21
21

More than 5 years have passed since last update.

Mountain Lion+Homebrew な環境で rmagick がインストールできない問題を解決する

Last updated at Posted at 2013-01-24

追記:ビルドスクリプトにパッチを当てたバージョンの rmagick を使う方法もある→rmagick を最近の環境でもインストール出来るようにする方法

この記事で想定するバージョン:

  • imagemagick: 6.8.0-10
  • rmagick: 2.13.1

参考にしたページ: http://stackoverflow.com/a/14097234/454997

Homebrew で imagemagick をインストールし、 gem install rmagick すると以下のエラーが出る。


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

        /Users/uasi/.rbenv/versions/1.9.3-p194-perf/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
(中略)
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagick++... no
Can't install RMagick 2.13.1. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

この問題を解決するには、 rmagick が期待するファイル名になるように imagemagick ライブラリのシンボリックリンクを作ってやればよい:


# imagemagick のライブラリディレクトリに移動
cd /usr/local/Cellar/imagemagick/6.8.0-10/lib

# ライブラリのファイル名からバージョンを除いたシンボリックリンクを作る
ln -s libMagick++-Q16.7.dylib   libMagick++.dylib
ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib

# ライブラリを配置し直す
brew unlink imagemagick
brew link imagemagick

21
21
0

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
21
21