How to install ImageMagick® from source on OS X 10.11 through macOS 14.x Sonoma
With trial and error, I have managed to compile and install the latest ImageMagick supporting PNG file format from source. 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 -LO https://www.zlib.net/zlib-1.3.1.tar.gz tar zxf zlib-1.3.1.tar.gz 2. Configure zlib cd zlib-1.3.1 ./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 -LO https://download.sourceforge.net/libpng/libpng-1.6.43.tar.gz tar zxf libpng-1.6.43.tar.gz 2. Configure libpng cd libpng-1.6.43 ./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 -LO https://imagemagick.org/archive/ImageMagick-7.1.1-30.tar.gz tar zxf ImageMagick-7.1.1-30.tar.gz 2. Configure ImageMagick cd ImageMagick-7.1.1-30 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: DELEGATES = bzlib png zlib 4. Compile make && make check "make check" will end up with as below: ============================================================================ Testsuite summary for ImageMagick 7.1.1-30 ============================================================================ # TOTAL: 87 # PASS: 87 # SKIP: 0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ 5. Install sudo make install 6. Set search path export PATH="/usr/local/magick/bin:$PATH" 7. Verify ImageMagick installed properly identify -version Version: ImageMagick 7.1.1-30 Q16-HDRI x86_64 22086 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Delegates (built-in): bzlib png zlib Compiler: gcc (4.2) 8. Verify ImageMagick is working properly convert logo: ~/Desktop/logo.png identify ~/Desktop/logo.png /Users/xxx/Desktop/logo.png PNG 640x480 640x480+0+0 8-bit sRGB 256c 27434B 0.000u 0:00.000 9. At last open logo.png and confirm the following ImageMagic Logo appears. 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 This problem has now been corrected and the FreeType library does not necessarily need to be installed. You occasionally may be encountered in a configuration failure ending up with: configure: error: in `/Users/xxx/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 -LO https://ftpmirror.gnu.org/libtool/libtool-2.4.7.tar.gz tar zxf libtool-2.4.7.tar.gz 2. Configure libtool cd libtool-2.4.7 ./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 CFLAGS="-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, PNG, TIFF, etc.), 1. Install the latest libraries you need such as JPEG and TIFF: cd ~/Desktop curl -LO http://www.ijg.org/files/jpegsrc.v9f.tar.gz tar zxf jpegsrc.v9f.tar.gz cd jpeg-9e ./configure --prefix=/usr/local/jpeg make && sudo make install cd ~/Desktop curl -LO https://download.osgeo.org/libtiff/tiff-4.6.0.tar.gz tar zxf tiff-4.6.0.tar.gz cd tiff-4.6.0 ./configure --prefix=/usr/local/libtiff make && sudo make install 2. Configure ImageMagick like this: export LDFLAGS="-L/usr/local/jpeg/lib/ -L/usr/local/libpng/lib/ -L/usr/local/libtiff/lib/" export CFLAGS="-I/usr/local/jpeg/include -I/usr/local/libpng/include -I/usr/local/libtiff/include" export PKG_CONFIG_PATH="/usr/local/jpeg/lib/pkgconfig/:/usr/local/libpng/lib/pkgconfig/:/usr/local/libtiff/lib/pkgconfig/:/usr/local/zlib/lib/pkgconfig/" ./configure --prefix=/usr/local/magick --with-jpeg --with-png --with-tiff 3. Verify configuration ends up with the report as follows: DELEGATES = bzlib jng jpeg png tiff zlib 4. Compile make && make check "make check" will end up with as below: ============================================================================ Testsuite summary for ImageMagick 7.1.1-30 ============================================================================ # TOTAL: 87 # PASS: 87 # SKIP: 0 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ 5. Install sudo make install 6. Set search path export PATH="/usr/local/magick/bin:$PATH" 7. Verify ImageMagick installed properly magick --version Version: ImageMagick 7.1.1-30 Q16-HDRI x86_64 22086 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Delegates (built-in): bzlib jng jpeg png tiff zlib Compiler: gcc (4.2) 8. Verify ImageMagick is working properly convert logo: ~/Desktop/logo.jpeg convert logo: ~/Desktop/logo.tiff 9. At last open logo.jpeg and logo.tiff then confirm the following ImageMagic Logo appears. Another approach when multiple libraries are needed: 1. Install all necessary dependencies and libraries such as JPEG and TIFF in one place: cd ~/Desktop curl -O https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz tar zxf pkg-config-0.29.2.tar.gz cd pkg-config-0.29.2 export LDFLAGS="-framework CoreFoundation" ./configure --with-internal-glib --prefix=/usr/local/magick2 make && sudo make install cd ~/Desktop curl -LO https://www.zlib.net/zlib-1.3.1.tar.gz tar zxf zlib-1.3.1.tar.gz cd zlib-1.3.1 ./configure --prefix=/usr/local/magick2 make && sudo make install cd ~/Desktop curl -LO https://download.sourceforge.net/libpng/libpng-1.6.43.tar.gz tar zxf libpng-1.6.43.tar.gz cd libpng-1.6.43 ./configure --prefix=/usr/local/magick2 make && sudo make install cd ~/Desktop curl -LO http://www.ijg.org/files/jpegsrc.v9f.tar.gz tar zxf jpegsrc.v9f.tar.gz cd jpeg-9e ./configure --prefix=/usr/local/magick2 make && sudo make install cd ~/Desktop curl -LO https://download.osgeo.org/libtiff/tiff-4.6.0.tar.gz tar zxf tiff-4.6.0.tar.gz cd tiff-4.6.0 ./configure --prefix=/usr/local/magick2 make && sudo make install 2. Configure ImageMagick like this: export PATH="/usr/local/magick2/bin:$PATH" ./configure --prefix=/usr/local/magick2 --with-jpeg --with-png --with-tiff --with-includearch-dir="/usr/local/magick2/include" --with-sharearch-dir="/usr/local/magick2/lib/" --with-pkgconfigdir="/usr/local/magick2/lib/pkgconfig/"
|