imagemagick fails with dyld: Library not loaded
Looking at the error, we identify the missing file:
/usr/local/opt/little-cms2/lib/liblcms2.2.dylib
The first step is to make sure that the library is actually existing:
find /usr -name '*liblcms*'
find: /usr/sbin/authserver: Permission denied
/usr/local/lib/liblcms.1.0.19.dylib
/usr/local/lib/liblcms.1.dylib
/usr/local/lib/liblcms.a
/usr/local/lib/liblcms.dylib
/usr/local/Cellar/little-cms/1.19_1/lib/liblcms.1.0.19.dylib
/usr/local/Cellar/little-cms/1.19_1/lib/liblcms.1.dylib
/usr/local/Cellar/little-cms/1.19_1/lib/liblcms.a
/usr/local/Cellar/little-cms/1.19_1/lib/liblcms.dylib
/usr/local/Cellar/little-cms2/2.9/lib/liblcms2.dylib
/usr/local/Cellar/little-cms2/2.9/lib/liblcms2.a
/usr/local/Cellar/little-cms2/2.9/lib/liblcms2.2.dylib
So we can see that it does exist as /usr/local/Cellar/little-cms2/2.9/lib/liblcms2.2.dylib
.
We need to create a symbolic link that will make convert find the missing file. It is possible that the brew installation script was missing to do that.
The way to create a symlink goes like this:
ln -s <exisiting file> <pointer to create>
So the final solution is simply this:
ln -s /usr/local/Cellar/little-cms2/2.9 /usr/local/opt/little-cms2
Let's verify:
convert
Version: ImageMagick 7.0.10-0 Q16 x86_64 2020-04-04 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(3.1)
Delegates (built-in): bzlib freetype gslib heic jng jp2 jpeg lcms ltdl lzma openexr png ps tiff webp xml zlib
Usage: convert [options ...] file [ [options ...] file ...] [options ...] file
...
Mission completed :)