Getting ImageMagick running on MAMP

Having spent several days fighting with Lion, compilers, missing libraries and generally messing up my laptop beyond sensible use I have finally got ImageMagick running.

I will attempt to get together all the steps I went through to get ImageMagick running on MAMP on MAC OS Lion. I have had to update things, for some reason I have one laptop that allows you to load a binary that isn’t universal, and another machine that requires things to be compiled as a universal binary.

Firstly I had to get a bunch of things installed:

  • Install MAMP
  • download “MAMP Components”
  • Install XCode
  • Install Macports

Once you have spent several hours installing that lot you can begin to get to the command line.

Open a new terminal;

:$ cd ~
:$ sudo port selfupdate
:$ sudo port upgrade outdated
:$ sudo port install imagemagick

Uncompress from MAMP Components.

:$ mv php5.x.x /Applications/MAMP/bin/php/php5.x.x/includes/php
:$ cd /Applications/MAMP/bin/php/php5.x.x/include/php

Setting the follwoing config options are to set the build target for MAc OS Lion Universal binaries

:$ MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
:$ ./configure 
:$ sudo port upgrade --force installed

Once configure has done its magic you should be ready to start the build process for the pecl extension of ImageMagick.

:$ cd /Applications/MAMP/bin/
:$ sudo pecl install imagick

Edit the file ‘/Applications/MAMP/Library/bin/envvars’ and comment out the following lines:


Im not sure why having the correct library path causes an issue, but this worked for me.

Next you can add “” to your php.ini

Restart Apache in the manner you like, Im lazy and just stop and start my servers from the MAMP GUI.

The following were used in research:

~ by mrhelly on 22/01/2012.


Get every new post delivered to your Inbox.

%d bloggers like this: