Setting DYLD_LIBRARY_PATH on macOS has unintended consequences
Setting DYLD_LIBRARY_PATH
(3a5c4dc8) not only adds to the location dyld searches for libraries, it overrides where dyld searches for libraries.
This is known to cause issues.
For example, the install path of a library points to /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib
, but dyld attempts to use /opt/local/lib/libjpeg.dylib
instead because /opt/local/lib/
is part of DYLD_LIBRARY_PATH
.
See https://trac.macports.org/ticket/56301 for an example of this issue.
A search for "dyld: Symbol not found: __cg_jpeg_resync_to_restart" will give other examples.
May I suggest that setting DYLD_FALLBACK_LIBRARY_PATH
is a safer option.
According to the man page, it is "default location for libraries not found in their install path," which seems closer to what is desired (https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/dyld.1.html).