Picture of Brian Love wearing black against a dark wall in Portland, OR.

Brian Love

Imagemagick Installation with OS X Mavericks and PHP 5.4

I know that there are lots of posts and articles written for installing the imagick PHP extension, so why not one more. Most of the installer guides that I found were pretty dated, so I thought this might be helpful.

To install the imagick PHP extension we need to:

Install Ghostscript

I am using ghostscript version 9.14, which is the latest stable release available at the time of this post.

$ wget http://downloads.ghostscript.com/public/ghostscript-9.14.tar.gz
$ tar zxvf ghostscript-9.14.tar.gz
$ cd ghostscript-9.14
$ ./configure
$ make
$ sudo make install

Install Imagemagick

$ wget http://www.imagemagick.org/download/ImageMagick.tar.gz
$ tar zxvf ImageMagick.tar.gz
$ cd ImageMagick-6.8.9-7
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig /usr/local/lib
$ make check

Install imagick

I was getting an error when attempting to install the latest stable imagick release (3.1.2). The error that I was getting was:

fatal error: 'wand/MagickWand.h' file not found

To resolve this, I used the latest beta release (3.2.0RC1).

$ wget http://pecl.php.net/get/imagick-3.2.0RC1.tgz
$ tar zxvf imagick-3.2.0RC1.tgz
$ cd imagick-3.2.0RC1
$ phpize
$ ./configure --with-imagick=/opt/local
$ make
$ sudo make install
$ make test

Configure PHP

Simply modify your php.ini file to add a reference to the new extension.

extension=imagick.so

All set. It seems like a bit of a right of passage to install the imagick extension. Good luck!

As a last side note I wanted to also mention that I did attempt to install these using homebrew, but ran into the same error message regarding the MagickWand.h header file that I encountered when installing the latest stable release of imagick.