MacOS – How to install imagick via homebrew

homebrewmacos

I am trying to install imagick using homebrew. The issue is that MagickWand libaries cannot be found.

$ brew install php54-imagick
==> Downloading http://pecl.php.net/get/imagick-3.1.0RC2.tgz
Already downloaded: /opt/boxen/cache/homebrew/php54-imagick-3.1.0RC2.tgz
==> Patching
patching file imagick-3.1.0RC2/config.m4
==> PHP_AUTOCONF="/opt/boxen/homebrew/opt/autoconf/bin/autoconf" PHP_AUTOHEADER="/opt/boxen/homebrew/opt/autoconf/bin/autoheader" /opt/boxen/homebrew/Cellar/php54/5.4.26/bin/phpize
==> ./configure --prefix=/opt/boxen/homebrew/Cellar/php54-imagick/3.1.0RC2 --with-php-config=/opt/boxen/homebrew/Cellar/php54/5.4.26/bin/php-config
checking for awk... awk
checking if awk is broken... no
checking whether to enable the imagick extension... yes, shared
checking whether to enable the imagick GraphicsMagick backend... no
checking ImageMagick MagickWand API configuration program... configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/josegonzalez/homebrew-php/issues

There is an issue on github for that bug yet it got closed. There seemed to be a fix for that bug, but it got closed and cherry-picking is not possible for me.

Best Answer

As mentioned on this answer : https://stackoverflow.com/a/17848864/2307070

you can try these steps:

wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
tar zxf imagick-3.1.0RC2.tgz

Edit the file imagick-3.1.0RC2/config.m4 line number 55.

Make changes like this, from

if test -r $WAND_DIR/include/ImageMagick/wand/MagickWand.h;

to

if test -r $WAND_DIR/include/ImageMagick-6/wand/MagickWand.h;

Note this difference made in the imagick version number. After that try the conventional installation procedures

cd imagick-3.1.0RC2
phpize
./configure
make
make install