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

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
6
Help us understand the problem. What is going on with this article?
@tanaka-t

rmagickインストール時に確認すべきこと

More than 1 year has passed since last update.

今回インストールするにあたり、エラー解決に時間を要しましたので、
以下にまとめておきます。

対応する環境

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

補遺

6
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
tanaka-t

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
6
Help us understand the problem. What is going on with this article?