Imagemagickはコマンドラインから画像の操作や表示ができるツール。
多くのOS及び言語から使用できるため人気がある。
RMagickはRuby用のImagemagickインターフェース。
RubyからImagemagickを使用する場合は、このgemをインストールする。
Imagemagickのインストール
RMagickはimagemagickのバージョン6にしか対応していないので
バージョン6をインストール。
$ brew install imagemagick@6
パスを.bash_profileに設定
export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"
$ source ~/.bash_profile
以下のコマンドでバージョン情報が表示されれば、インストール完了
$ convert --version
RMagickのインストール
インストール
gem 'carrierwave' gem 'rmagick'
このままインストールすると、以下のエラーが出てインストールできない。
Package MagickCore was not found in the pkg-config search path.
Perhaps you should add the directory containing `MagickCore.pc'
to the PKG_CONFIG_PATH environment variable
No package 'MagickCore' found
MagickCore.pcが含まれるパスであるPKG_CONFIG_PATHを
環境変数に設定する必要がある。
.bash_profile
export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig:$PATH"
$ source ./bash_profile
インストール
$ bundle install
[参考]
Macにrmagickをインストールする - Qiita
RMagickのインストールでエラー - Qiita