20
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

imagemagick と rmagick のインストールでつまづいたときに確認する手順

Last updated at Posted at 2017-09-05

毎回悩むので手順をまとめました。

対応する環境

Mac OS X 10.12.6
ruby 2.4.1p111
imagemagick@6 6.9.9-10
rmagick 2.16.0

よく見かけるエラー

gem install, bundle install 時のエラー。

Installing rmagick 2.16.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    :
Can't install RMagick 2.16.0. Can't find MagickWand.h.

bundle doctor のエラー。

% bundle doctor
The Gemfile's dependencies are satisfied
The following gems are missing OS dependencies:
 * rmagick: /usr/local/opt/imagemagick/lib/libMagickCore-6.Q16.3.dylib
 * rmagick: /usr/local/opt/imagemagick/lib/libMagickWand-6.Q16.3.dylib

ImageMagick をインストールする

現行の rmagick v2.16.0 の対応するバージョンは ImageMagick v6 までです。
ImageMagick v7 には対応していません。

imagemagick 6 をインストールする

brew で ImageMagick v6 系を再インストールします。

% brew uninstall --force imagemagick@6
% brew install imagemagick@6

パスが追加されていなければ追加します。

~/.zshrc
export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"

動作を確認する

convert コマンドで動作を確認します。

% convert --version
Version: ImageMagick 6.9.9-10 Q16 x86_64 2017-08-28 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

rmagick をインストールする

rmagick を uninstall する

rmagick を uninstall します。

% bundle exec gem uninstall rmagick
Successfully uninstalled rmagick-2.16.0

PKG_CONFIG_PATH を調べる

% brew info imagemagick@6
    :
If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/imagemagick@6/lib
    CPPFLAGS: -I/usr/local/opt/imagemagick@6/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/imagemagick@6/lib/pkgconfig

rmagick を bundle install する

gem 'rmagick'bundle install します。

% PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig bundle install --path vendor/bundle

確認します。

% bundle doctor
The Gemfile's dependencies are satisfied
No issues found with the installed bundle

補遺

20
14
1

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
20
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?