Memorandum: How to install ImageMagick® from source on OS X 10.11, 10.12 and 10.13 High Sierra

How to install ImageMagick® from source on OS X 10.11, 10.12 and 10.13 High Sierra

With trial and error, I have managed to compile and install the latest ImageMagick supporting PNG file format from source.
This is the memorandum how to compile and install ImageMagick from source on OS X 10.11, mac OS 10.12 Sierra and
mac OS 10.13 High Sierra without MacPorts nor Homebrew.

Modern releases of ImageMagick 6.9.3.x use libpng.pc to find and configure the PNG reference library.
Compiling ImageMagick 7.0.1.x with the PNG delegate library, pkg-config is required.
For compiling ImageMagick 7.0.6.x with the latest PNG library (libpng ≧1.6.31), zlib library is required.

1) First, install pkg-config.
2) Second, install zlib.
3) Third, install libpng.
4) Then you can compile and install ImageMagick with the PNG reference library.




Install pkg-config

1. Download the latest pkg-config
cd ~
curl -O https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
tar zxf pkg-config-0.29.2.tar.gz

2. Configure pkg-config
cd pkg-config-0.29.2
export LDFLAGS="-framework CoreFoundation" 
./configure --with-internal-glib --prefix=/usr/local/pkgconfig

3. Compile and install pkg-config
make && make check
sudo make install

4. Set search path
export PATH="/usr/local/keyconfig/bin:$PATH"




Install zlib

1. Download the latest zlib
cd ~
curl -O https://www.zlib.net/zlib-1.2.11.tar.gz
tar zxf zlib-1.2.11.tar.gz

2. Configure zlib
cd zlib-1.2.11
./configure --prefix=/usr/local/zlib

3. Compile and install zlib
make && make check
sudo make install




Install libpng

1. Download the latest libpng
cd ~
curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.37.tar.gz
tar zxf libpng-1.6.37.tar.gz

2. Configure libpng
cd libpng-1.6.37
./configure --prefix=/usr/local/libpng

3. Compile and install libpng
make && make check
sudo make install




Install ImageMagick

1. Download the latest ImageMagick
cd ~
curl -O https://www.imagemagick.org/download/ImageMagick-7.0.9-2.tar.gz
tar zxf ImageMagick-7.0.9-2.tar.gz

2. Configure ImageMagick
cd ImageMagick-7.0.9-2
export PKG_CONFIG_PATH="/usr/local/libpng/lib/pkgconfig/:/usr/local/zlib/lib/pkgconfig/"
./configure --prefix=/usr/local/magick --with-png

3. Verify configuration ends up with the report as follows:
PNG               --with-png=yes		yes

4. Compile and install ImageMagick
make
sudo make install

5. Set search path
export PATH="/usr/local/magick/bin:$PATH"

6. Verify ImageMagick installed properly
identify -version
Version: ImageMagick 7.0.9-2 Q16 x86_64 2019-10-31 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI 
Delegates (built-in): bzlib png zlib

7. Verify ImageMagick is working properly
convert logo: ~/Desktop/logo.png
identify ~/Desktop/logo.png
/Desktop/logo.png PNG 640x480 640x480+0+0 8-bit sRGB 256c 27398B 0.000u 0:00.001

8. At last open logo.png and confirm the following ImageMagic Logo appears.

ImageMagic Logo

9. If the FreeType library is not installed, you do not pass the unit tests and "make check" may end up with:
=========================================
   ImageMagick 7.0.4: ./test-suite.log
=========================================
# TOTAL: 86
# PASS:  84
# SKIP:  0
# XFAIL: 0
# FAIL:  2
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: tests/wandtest
====================
wandtest: delegate library support not built-in '/Library/Fonts//Arial.ttf' (Freetype) 
@ warning/annotate.c/RenderFreetype/1792.
...
FAIL: tests/wandtest.tap 1

FAIL: Magick++/demo/demos
=========================
button: delegate library support not built-in '/Library/Fonts//Arial.ttf' (Freetype) 
@ warning/annotate.c/RenderFreetype/1792.
...
FAIL: Magick++/demo/demos.tap 6




You occasionally may be encountered in a configuration failure ending up with:
configure: error: in `/Users/eiichi/Desktop/ImageMagick-7.0.8-66':
configure: error: libltdl is required for modules and OpenCL builds

If so, install libtool to avoid an error.


Install libtool

1. Download the latest libtool
cd ~
curl -O ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.gz
tar zxf libtool-2.4.6.tar.gz

2. Configure libtool
cd libtool-2.4.6
./configure --prefix=/usr/local/libtool

3. Compile and install pkg-config
make
sudo make install

4. Set search path
export PATH="/usr/local/libtool/bin:/usr/local/libtool/share:$PATH"

5. Configure ImageMagick like this:
export LDFLAGS="-L/usr/local/libtool/lib/"
export CPPFLAGS="-I/usr/local/libtool/include"
export PKG_CONFIG_PATH="/usr/local/libpng/lib/pkgconfig/:/usr/local/zlib/lib/pkgconfig/"
./configure --prefix=/usr/local/magick --with-png





If you need more than one library (e.g. jpeg, pdf, png, tiff, etc.),

1. Place pkg-config and those libraries into the same directory:
/usr/local/magick

2. Configure ImageMagick like this:
export LDFLAGS="-L/usr/local/magick/lib/"
export CPPFLAGS="-I/usr/local/magick/include"
export PKG_CONFIG_PATH="/usr/local/magick/lib/pkgconfig/"
./configure --prefix=/usr/local/magick --with-freetype --with-jpeg --with-png --with-tiff

3. Verify configuration ends up with the report as follows:
FreeType          --with-freetype=yes       yes
JPEG v1           --with-jpeg=yes           yes
PNG               --with-png=yes            yes
TIFF              --with-tiff=yes           yes

4. Compile and install ImageMagick
make
sudo make install

5. Set search path
export PATH="/usr/local/magick/bin:$PATH"

6. Verify ImageMagick installed properly
identify -version
Version: ImageMagick 7.0.6-3 Q16 x86_64 2017-07-25 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI
Delegates (built-in): bzlib freetype jpeg png tiff



Links…

mail


Firefox Get ¤