Nicholas.V
Nicholas.V

Reputation: 1936

ImageMagick / GhostScript - dyld: Library not loaded: /usr/local/lib/libjbig2dec.0.dylib

When I run convert file.pdf or gs command in terminal I get the following error:

dyld: Library not loaded: /usr/local/lib/libjbig2dec.0.dylib
  Referenced from: /usr/local/bin/gs
  Reason: image not found

I installed imagemagick and ghostscript using homebrew:

brew install imagemagick
brew install gs

I have tried solutions in related questions such as reinstalling, relinking etc but I just can't get it to work.

I have also tried:

brew uninstall libtool
brew install libtool --universal
brew unlink libtool && brew link libtool --force

Homebrew, libtool, imagemagick and ghostscript are all up to date and I am running the latest version of Mavericks.

Any ideas on how to fix this problem?

Upvotes: 5

Views: 2223

Answers (2)

Nicholas.V
Nicholas.V

Reputation: 1936

I finally fixed the problem with a surprisingly simple solution:

  1. I tried brew install jbig2dec which returned Warning: jbig2dec-0.11 already installed.

  2. I then checked to see if it it was linked: brew link jbig2dec which returned Warning: Already linked: /usr/local/Cellar/jbig2dec/0.11

  3. I then ran brew unlink jbig2dec && brew link jbig2dec to relink it.

Voilà! GhostScript now works.

Upvotes: 6

KenS
KenS

Reputation: 31139

The Ghostscript you are using has been compiled using shared libraries (which we don't reccomend but packagers are very keen on). You obviously don't have the JBIG2dec shared library on your system. As far as I can see you have 2 choices:

1) Find and install the shared library version of Jbig2dec (you can get jbig2dec from the ghostscript site I think). You may have to build it yourself and I'm doubtful that the standard build will create a shared object.

2) Recompile Ghostscript from source so that it doesn't use shared libraries.

Upvotes: 0

Related Questions