I've had success on OS X with perlbrew + Image::Magick + homebrew. Here's how:
1. First install your perls with perlbrew. Instructions at
http://perlbrew.pl. I did the easy copy/paste into the terminal.
2. Next install homebrew. Instructions at
http://brew.sh. Again, easy copy/paste into the terminal.
3. Then install imagemagick dependencies. I think homebrew would resolve deps for you, but for some reason I like to do it manually. Holdover from the olden days of manually compiling and installing ImageMagick from source, maybe.
Code: Select all
brew deps --1 imagemagick | xargs brew install
If you delete the "| xargs..." from the command above, it just shows you the basic imagemagick dependencies. With the pipe-xargs, homebrew does the installation of those dependencies. If you spend much time on the command line and aren't familiar with "xargs", it's worth studying.
4. Enter "brew edit imagemagick" in the terminal to modify the default homebrew formula for imagemagick. This will open up a file "imagemagick.rb" in a text editor (probably vi or vim in your terminal). Navigate to around line 60, where the installation args are specified, and make a couple changes. In the "git diff" output below you can see the 2 lines I added marked with "+" on the left margin. The perl path on the right is just the output of "which perl" from the command line. The other addition is to support Ghostscript for vector image processing.
Code: Select all
diff --git i/Library/Formula/imagemagick.rb w/Library/Formula/imagemagick.rb
index 22f0164..e29fd64 100644
--- i/Library/Formula/imagemagick.rb
+++ w/Library/Formula/imagemagick.rb
@@ -60,6 +60,8 @@ class Imagemagick < Formula
def install
args = [ "--disable-osx-universal-binary",
"--prefix=#{prefix}",
+ "--with-perl=/Users/jkortegard/perl5/perlbrew/perls/perl-5.18.1/bin/perl",
+ "--with-gslib",
"--disable-dependency-tracking",
"--enable-shared",
"--disable-static",
(END)
5. Save your changes to the "imagemagick.rb" file and install ImageMagick using homebrew. Mine are shown below.
NOTE: you need to include the "--with-perl" option on the command line for homebrew to build and install PerlMagick correctly as part of the ImageMagick installation. The "-vd" options give you verbose debug output to screen while installing. If you're used to building ImageMagick, it will look familiar.
Code: Select all
$ brew install -vd --fresh imagemagick --with-fontconfig --with-freetype --with-webp --with-ghostscript --with-jasper --with-librsvg --with-libtiff --with-little-cms --with-quantum-depth-8 --with-perl
6. Confirm you have a working PerlMagick.
Code: Select all
$ perl -wle 'use Image::Magick; print Image::Magick->new->Get("version"); print "perl version " , $];'
ImageMagick 6.8.7-7 Q8 x86_64 2013-11-29 http://www.imagemagick.org
perl version 5.018001
If you want to have
multiple PerlMagick installs, for each of your perlbrew versions, you can do that too. I have it built for 5.16 and 5.18 currently. It might be a total hack, but it seems to work. Here's what I did:
1. Everything above for a given Perl version.
2. "brew rm imagemagick" -- Delete the installed ImageMagick. This does NOT remove any of the PerlMagick installation.
3. "perlbrew switch perl-5.16.3"
4. Repeat the "brew edit" step above to update the perl path in the imagemagick.rb file to the freshly activated perlbrew version.
5. Repeat the "brew install" step above verbatim.
Now I can switch Perls and Image::Magick plays along nicely:
Code: Select all
$ perlbrew list
perl-5.16.3
* perl-5.18.1
$ perl -wle 'use Image::Magick; print Image::Magick->new->Get("version"); print "perl version " , $];'
ImageMagick 6.8.7-7 Q8 x86_64 2013-11-29 http://www.imagemagick.org
perl version 5.018001
$ perlbrew switch perl-5.16.3
$ perl -wle 'use Image::Magick; print Image::Magick->new->Get("version"); print "perl version " , $];'
ImageMagick 6.8.7-7 Q8 x86_64 2013-11-29 http://www.imagemagick.org
perl version 5.016003
$
Caveat: I have not done rigorous testing of every aspect of PerlMagick after these installations. It works as far as I can tell, though.
Jamin