After using the Homebrew package manager to install a few gtk-related packages on my Macbook (macOS Sierra, 10.12.4), I experienced an alarming problem: I could no longer launch ROOT. When I tried, I got a message like this:
err: dyld: Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO Expected in: /usr/local/lib/libjpeg.8.dylib
Yikes! Luckily, I’m not the first one to have this problem. It turns out that installing the gtk-related packages also installs various image-related packages (jpeg, libtiff, libpng). The interplay between Homebrew and MacOS sometimes results in a conflict, where Homebrew places a dynamic library in /usr/local/lib, and then that takes precedence over the system’s dynamic library in /System/Library/. (You’d think that this wouldn’t happen, given that Homebrew is designed for MacOS, but still…) There are a few different possibilities for trying to force the correct library (in /System/Library/) to load, but perhaps the most straightforward is to blow up the new library in /usr/local/lib and replace it with a symbolic link to the system library. Here’s a nice blog post with a clear explanation, starting about halfway down the page with the paragraph beginning “But we’re not quite done yet.”
To sum up, there’s a two-command sequence which you’ll want to repeat for all three libraries (first after confirming that the correct libraries really do exist in the /System directory):
$ cd /usr/local/lib $ rm libjpeg.dylib $ ln -s /System/Library/Frameworks/ImageIO.framework/Resources/libJPEG.dylib libJPEG.dylib $ rm libtiff.dylib $ ln -s /System/Library/Frameworks/ImageIO.framework/Resources/libTIFF.dylib libTIFF.dylib $ rm libpng.dylib $ ln -s /System/Library/Frameworks/ImageIO.framework/Resources/libPng.dylib libPng.dylib
You may also have a libgif issue, which you can clean up the same way; for whatever reason, I did not.