Installing ImageMagick on OSX
Posted Dec 8, 2006
(updated Jun 14, 2007)
I installed ImageMagick on a Mac OSX server this week and figured I'd share the necessary steps and details here. (Hey Mac-based developers and designers, these instructions will also work for installing ImageMagick on your personal Mac, too.)
What's ImageMagick?
ImageMagick is a code library that can do loads of different operations and transformations on image files. Most folks use ImageMagick only indirectly; it's commonly used as a utility by other programs. Big Medium uses it for resizing images, as do a host of other applications and image galleries.
Let's get after it
I used the following steps to install ImageMagick on OSX Tiger (10.4.8). To make things easier, we'll use MacPorts (formerly called DarwinPorts) to do most of the heavy lifting.
Install MacPorts
MacPorts is an open-source utility that simplifies the installation of other open-source software, including ImageMagick and the various code libraries that it requires to get going.
The MacPorts site has complete installation instructions.
Install ImageMagick
After your installation of MacPorts is complete, open the Terminal application, and enter this command on the command line:
sudo port install ImageMagick
This step can take quite a while to run, over an hour, and at times it may not look like it's doing anything at all. Grab a cup of coffee, and come back when it's done.
Download the matching ImageMagick package
ImageMagick is now installed, but we still have to install its Perl plugin ("PerlMagick") to let it work with Big Medium and other Perl apps. To get started, go to the ImageMagick site and download the ImageMagick package for the version you just installed. To find out the version number, type this command on the command line:
port info ImageMagick
When you have the version number in hand, go to the ImageMagick download page and download the ImageMagick package of the same name. I installed version 6.3.0-7, for example, so the package to grab was ImageMagick-6.3.0-7.tar.bz2.
Unzip the ImageMagick package
If you're unzipping the file from the command line, use these commands (changing the name of the file as necessary to match your version number):
bzip2 -d ImageMagick-6.3.0-7.tar.bz2
tar -xvf ImageMagick-6.3.0-7.tar
Update PerlMagick's Makefile.PL
Inside the unzipped Image directory is a directory named PerlMagick:
cd ImageMagick-6.3.0-7/PerlMagick
Inside that directory is a file named Makefile.PL. You need to make two changes to that file to point to the location where MacPorts installed ImageMagick.
Find these lines:
# Header search specfication (sic) and preprocessor flags
'INC' => '-I../ -I.. -I/usr/include/freetype2 -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I/usr/include/libxml2',
...and change the second line like so, adding "-I/opt/local/include":
# Header search specfication (sic) and preprocessor flags
'INC' => '-I/opt/local/include -I../ -I.. -I/usr/include/freetype2 -I/usr/X11R6/include -I/usr/X11R6/include/X11 -I/usr/include/libxml2',
Then find these lines:
# Library specification
'LIBS' => ['-L/usr/lib -lMagick -L/usr/X11R6/lib64 -L/usr/lib -ltiff -ljpeg -lpng -ldpstk -ldps -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lpthread -lm -lpthread'],
...and change the second line to add "-L/opt/local/lib":
# Library specification
'LIBS' => ['-L/opt/local/lib -L/usr/lib -lMagick -L/usr/X11R6/lib64 -L/usr/lib -ltiff -ljpeg -lpng -ldpstk -ldps -lXext -lXt -lSM -lICE -lX11 -lbz2 -lxml2 -lpthread -lm -lpthread'],
Install PerlMagick
Run the PerlMagick installer by running these commands from the command line:
perl Makefile.PL
make
sudo make install
And that's it, you're done. Happy magicking.
Tags:
imagemagick,
osx,
software
Want more?
Recent blog entries...
More from this section
Blissed out on On-Demand PrintingConvenient printing and publishing services cut out the distraction that used to weigh down the production of marketing collateral for entrepreneurs and small businesses.
Housekeeping: Support forum accountsThe forum has a couple of shiny new features that frequent visitors may find useful.
Keeping up with UpdatesOne of the challenges of software development is settling into a release schedule that is sustainable not only for you but for your customers. Here are some suggestions about what to expect from Big Medium updates and how to craft a manageable upgrade regimen.
Automate Site Backups with Big MediumWith Big Medium 2.0.4, your favorite neighborhood CMS learned how to back up its own data. Learn how to use this new feature.
Follow the Grid, Skip the LinesMy post office features a clever heat-map grid to announce slow and busy hours. A perfect idea for the web.
C’est la BeachAs Paris morphs into the Riviera, some clever icon design works its own transformation.
Amazon Image BookmarkletsAdd these to your browser for easy access to large images of book covers, album art or commercial products.
No Pain, No Pain: The “Couch to 5K” and Humane DesignI wrote the "C25K" training program for new runners over a decade ago. Its philosophy overlaps neatly with my philosophy of software design.
Is Your Service Plan about to Expire?Your service plan gives you free upgrades for Big Medium. Be sure that you're up-to-date before your plan expires, and find out details about how to renew.
Comments
9 comment(s) on this page: Add your own comment below.
I tried this and got errors on
make test, but so far it seems to have installed OK:/bin/sh ../magick.sh PERLDLNONLAZY=1 /opt/blocperl/bin/perl "-MExtUtils::Command::MM" "-e" "testharness(0, 'blib/lib', 'blib/arch')" t/*.t t/bzlib/*.t t/jpeg/*.t t/png/*.t t/ps/*.t t/tiff/*.t t/x/*.t t/zlib/*.t ../magick.sh: ../magick.sh: No such file or directory make: *** [testdynamic] Error 127
FWIW my macports version of ImageMagick is 6.3.3-7, which was not in the usual archives online. I finally found it here:
http://image_magick.veidrodis.com/image_magick/I ended up at your page because (of course) the macports version of perlmagick wouldn't install -- so thanks, you saved me at least half an hour of digging through configs!
I also had problems installing the p5-perlmagick port from MacPorts... I think it doesn't match the version of ImageMagick available. The CPAN perlmagick had the same problem.
Anyways reading this blog and following the
port infostep tipped me off to the fact the the ImageMagick port has a perl variant... so the following line does more or less the same thing, but with less interaction:Hi I was reading your instructions, and if you install ImageMagick using the +no_x11 option it's much quicker:
port install ImageMagick +no_x11The reason for this is that by default ImageMagick installs X11 which takes ages and you probably don't need it.
Would you care to elaborate as to how one would actually install Image Magick on a remote server? Anyone?
Thanks.
How remote is your server? If your server is anywhere on the network, then you can use ssh to connect to the server. ssh will give you the ability to make all the terminal commands, just as if you are sitting at the server. Naturally, you need to enable ssh on the server. Then, from terminal on your own mac, just type
ssh username@yourservername.something and login to your server
@erin I wish I'd read this prior to starting my install, it's insisting on x11 now! Useful tip I just needed it earlier :)
Hope the author adds it to the main content
Hello, I am trying to install imagemagick and thus far have found no success, I recieve two errors in attempting to install. I am not much of a terminal user, so all my guidence is coming from existing online help.
If I install via: sudo port install ImageMagick
I get the error: invalid command name "destroot.violate_mtree"
If I install via the suggested: port install ImageMagick +no_x11
I get: Error: Unable to execute port: /opt/local/var/macports/build/optlocalvarmacportssourcesrsync.macports.orgreleaseportsgraphicsImageMagick/work/.macports.ImageMagick.state is not writable - check permission on port directory
All help greatly appreciated.
Henry
Thanks to all for the comments and improvements on my original steps. It's on my to-do list to get around to cleaning up the main text above and/or posting another blog entry with the streamlined steps.
Henry, sorry to hear that you're having trouble. This post is just a "here's how I did it" message, and I'm afraid that I'm not able to offer support or troubleshooting. You might check in with the MacPorts mailing list for help. From the sound of it, though, you might have an out-of-date installation of macports. Give this a go:
In response to Henry
you need to throw a sudo into the statement
sudo port install ImageMagick +no_x11
Add a Comment
Don't be shy.