42

When I brew doctor I get the following errors:

dyld: Library not loaded: /usr/lib/libltdl.7.dylib
  Referenced from: /usr/local/bin/php
  Reason: image not found
Error: No available formula for zlib

The file libltdl.7.dylib is not in my /usr/lib directory, but there are several other .dylib files.

I'm running 10.8.1 with the latest version of Xcode (4.4.1) and its Command Line Tools installed.

Any idea how to solve these errors?

Ryan
  • 6,027
  • 16
  • 52
  • 89

14 Answers14

48

Try to re-install libtool by:

brew reinstall libtool --universal && brew unlink libtool && brew link libtool

If that doesn't help, try removing libtool completely, and then retry the steps above:

brew uninstall libtool

If it still doesn't work after trying the steps above, check to see if you have the DYLD_FALLBACK_LIBRARY_PATH variable defined somewhere on the system (e.g. ~/.profile) and try unsetting it before trying the steps above again.


Other commands which could be useful for identifying the issue:

$ libtool --version
$ whereis libtool
$ set | grep DYLD_FALLBACK_LIBRARY_PATH
$ echo $DYLD_FALLBACK_LIBRARY_PATH
waxwing
  • 117
  • 5
kenorb
  • 155,785
  • 88
  • 678
  • 743
  • 4
    I had to do `brew uninstall libtool` and then run your command and everything worked fine again. – Pavel Nikolov Nov 30 '13 at 14:23
  • +1 to the above comment (and answer). I too had to uninstall my problem package then reinstall via the provided answer. – Simon Whitehead Jul 23 '14 at 12:36
  • I had one issue when I tried to find out the version of libtool: error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `-' in: --version ........ My Xcode version is 7.3.0 – Kun Aug 20 '16 at 14:56
  • 6
    I made it without `--universal` and I'm Sierra 10.12.4; – Randy Lam Jan 21 '19 at 16:24
10

For me it works with:

sudo ln -s /usr/local/Cellar/libtool/2.4.2/lib/libltdl.7.dylib /usr/local/lib/libltdl.7.dylib
Raul
  • 254
  • 4
  • 4
  • This worked for me - my route had been via an update to OSX Mavericks followed by a Ruby update to 2.1.1 (since anything prior doesnt seem to compile under Mavericks) and then rmagick/imagemagick falling over, requiring reinstall of ImageMagick via brew and forcing rmagick to v 2.13.2 (since 2.13.4 gave issues) – Mitch Dec 07 '14 at 14:07
  • Best way I've found to handle these kinds of issues; if the DYLD library didn't get installed the first time, it generally doesn't get installed the nth time. – JESii Oct 27 '17 at 16:02
10

if you have an error about pcre like this :

dyld: Library not loaded: /usr/local/opt/pcre/lib/libpcre.1.dylib
  Referenced from: /usr/local/Cellar/watchman/4.7.0/libexec/bin/watchman
  Reason: image not found
Abort trap: 6

you need to link pcre.

brew link --overwrite pcre
fandro
  • 4,833
  • 7
  • 41
  • 62
Diego Mello
  • 5,220
  • 3
  • 17
  • 21
9

Try:

brew tap homebrew/dupes

See: https://github.com/josegonzalez/homebrew-php/pull/219

kenorb
  • 155,785
  • 88
  • 678
  • 743
2

None of them work I personally reinstalled Watchman like so:

brew uninstall watchman
brew reinstall watchman
Sydney C.
  • 950
  • 10
  • 21
1

The following worked for me:

brew uninstall --ignore-dependencies node
brew install node

Found the hint in this article: https://goulet.dev/posts/node-dyld-library-not-loaded-icu4c/

johanwannheden
  • 852
  • 8
  • 8
0
xcode-select --install
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install pcre
brew install libtool

that's it.

tolerious
  • 144
  • 1
  • 10
0

In my case I solve it with this link's file:

ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/opt/jpeg/lib/libjpeg.8.dyli
Luis Morales
  • 844
  • 12
  • 10
-1

The response from kenorb is what worked for me + a little extra for safe measure: brew update freetype didn't have symlinks so: brew link freetype various other solutions I tried:

brew remove imagemagick
brew link jpeg libpng
brew install imagemagick
brew install libtiff
brew uninstall libtool
brew reinstall libtool --universal && brew unlink libtool && brew link libtool

There's a good chance that this wasn't all necessary if I had found

brew uninstall libtool
brew reinstall libtool --universal && brew unlink libtool && brew link libtool

first. But I thought I would post my full process in case anyone runs into issues

jzg.dev
  • 123
  • 1
  • 13
-1

For me, I needed to fix XQuartz as brew doctor asked me too:

Warning: Your XQuartz (2.7.6) is outdated Please install XQuartz 2.7.8: https://xquartz.macosforge.org

It worked after that.

Francois Nadeau
  • 7,023
  • 2
  • 49
  • 58
-1

I experienced the same error in the process of installing AFNI. Installing PyQt, as suggested here, fixed the issue resulting from OSX 10.11 compatibility.

brew install pyqt
Chris Broz
  • 41
  • 6
-1

I had: % neato dyld: Library not loaded: /usr/lib/libltdl.7.dylib Referenced from: /Users/me/Documents/dev/anaconda/bin/neato Reason: image not found zsh: abort neato

And the fix was % echo $DYLD_FALLBACK_LIBRARY_PATH /Users/me/anaconda/lib:/usr/lib % export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/usr/local/lib

(and then add the export to a .bashrc or similar).

jmmcd
  • 731
  • 6
  • 15
-1

First :

brew uninstall libffi

Then :

brew install libffi
Amit
  • 1,841
  • 1
  • 19
  • 36
-1

In my case I had

dyld: Library not loaded: /usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/Python
  Referenced from: /usr/local/Cellar/macvim/8.2-162/MacVim.app/Contents/MacOS/Vim
  Reason: image not found

brew unlink python && brew link python and boom, fixed.

Mio
  • 1,412
  • 2
  • 19
  • 41