On my OS X 10.7.4 Mac I do:
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
But afterwards I get this sort of errors:
dyld: Library not loaded: /usr/lib/libncurses.5.4.dylib
Referenced from: /bin/ls
Reason: Incompatible library version: ls requires version 5.4.0 or later, but libncurses.5.4.dylib provides version 5.0.0
Trace/BPT trap: 5
To alleviate this problem, I've built the libncurses.5.4.dylib from scratch and installed it into the /usr/local/ncurses-5.9 and did:
sudo mv /usr/lib/libncurses.5.4.dylib /usr/lib/libncurses.5.4.dylib_BACKUP
sudo ln -s =/usr/local/ncurses-5.9/lib/libncursesw.5.4.dylib /usr/lib/libncurses.5.4.dylib
This newly built libncurses works fine but as soon as I do
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
it returns the same dyld: Library not loaded: /usr/lib/libncurses.5.4.dylib
As a comparison: When I do the same export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH on my OS X 10.5.6 Mac, it gives no error whatsoever. So I think it should work my OS X 10.7.4 Mac, too.
What should I do to make it work? Thank you.
Ops! When I checked the
/usr/local/libdirectory, I've found that there werelibncurses.dylibfiles there and because the exportedDYLD_LIBRARY_PATHwas loading them and they were obviously not binary compatible with the system, I was getting the error.After I deleted those obselete
libncurses.dylibfiles under/usr/local/libthe error is gone. Problem solved.