dyldotoolxquartz

XQuartz dynamic loading error


I updated XQuartz, and now it doesn't load, complaining that:

Dyld Error Message:
  Library not loaded: /opt/X11/lib/libfreetype.6.dylib
  Referenced from: /Applications/Utilities/XQuartz.app/Contents/MacOS/X11.bin
  Reason: Incompatible library version: X11.bin requires version 14.0.0 or later, but libfreetype.6.dylib provides version 13.0.0

However, if I otool -L /opt/X11/lib/libfreetype.6.dylib:

/opt/X11/lib/libfreetype.6.dylib:
    /opt/X11/lib/libfreetype.6.dylib (compatibility version 14.0.0, current version 14.2.0)
    ...

So the library is the right version!

What could cause this error?


Solution

  • Errors like this are caused by users setting DYLD_LIBRARY_PATH in their environment. This is likely done in either /etc/launchd.conf, /etc/profile, /etc/bashrc, ~/.profile, ~/.bashrc, ~/.bash_profile, or similar.

    DYLD_LIBRARY_PATH included a directory that contained a file named libfreetype.6.dylib which was used instead of the one included with XQuartz.

    Whoever gave you the recommendation to set DYLD_LIBRARY_PATH likely did so in error. It should only be used in very specific cases, such as in development environments. It should almost never be used in shipping products and never set as a general workaround in your shell environment.