ImageMagick with MAMP

Many web designers and front-end developers use MAMP due to its ease of use. However, MAMP unfortunately doesn’t come pre-installed with the very popular and wide spread image manipulation library ImageMagick. My fellow internet super talent Mario Lončarić recently clarified the steps for installing the ImageMagick library to your Mac installed with MAMP.

This article is probably not one for the Terminal savvy programmers, but rather for the rest of us using drag and drop web server packages such as MAMP.

Prior to getting started, I’m assuming you already have MAMP installed on your local computer, most likely in /Applications/MAMP. If not, install it before you move on to the next step.

First, download ImageMagick for Mac OS X and unarchive it to /Applications/MAMP/bin/ImageMagick.

Next, open up Terminal.app (don’t be afraid, it won’t bite you), and enter line by line:

$yourmacname> export MAGICK_HOME="/Applications/MAMP/bin/ImageMagick/ImageMagick-6.6.1"
$yourmacname> export PATH="$MAGICK_HOME/bin:$PATH"
$yourmacname> export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"

Test if everything works up to this point:

$yourmacname> cd /Applications/MAMP/bin/ImageMagick/ImageMagick-6.6.1
$yourmacname> convert logo: logo.gif
$yourmacname> identify logo.gif
$yourmacname> display logo.gif

Last: browse to /Applications/MAMP/Library/bin and open envvars file with your text editor. Change the two uncommented lines, i.e. DYLD_LIBRARY_PATH="... and export... to:

DYLD_LIBRARY_PATH="/Applications/MAMP/bin/ImageMagick/ImageMagick-6.6.1/lib:/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH

If you are using ImageMagick in your server-side application, be sure to set the correct path. For instance in PHP:

define('MAGICK_PATH', '/Applications/MAMP/bin/ImageMagick/ImageMagick-6.6.1/bin/convert');

Restart Apache in MAMP and you’re done.

Addenum

Some users have reported that the correct DYLD_LIBRARY_PATH for their particular setup was:

DYLD_LIBRARY_PATH="/Applications/MAMP/bin/ImageMagick/ImageMagick-6.6.1/lib:$DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH

Update for Mac OS X Yosemite users

If you had problems with starting Apache after updating to Yosemite, one of the proposed fixes was to rename envvars file to _envvars or to comment out lines containing DYLD_LIBRARY_PATH. That works if you don’t need to use ImageMagick, but DYLD_LIBRARY_PATH is required for it to function properly.

The solution is to rename DYLD_LIBRARY_PATH to DYLD_FALLBACK_LIBRARY_PATH in the envvars file.

DYLD_FALLBACK_LIBRARY_PATH ="/Applications/MAMP/bin/ImageMagick/ImageMagick-6.6.1/lib:$DYLD_FALLBACK_LIBRARY_PATH"
export DYLD_FALLBACK_LIBRARY_PATH

Marko Dugonjić is a designer specialized in user experience design, web typography and web standards. He runs a nanoscale user interface studio Creative Nights and organizes FFWD.PRO, a micro-conference and workshops for web professionals.

Interested in more content like this?