MacOSX: which dynamic libraries linked by binary?
Rob Mayoff's answer is a great solution when working with executables. If you find you need to check the runtime dependencies of a dylib, the following script my-ldd
may be useful.
#!/usr/bin/env bash
while getopts "r" OPTION; do
case $OPTION in
r) export DYLD_PRINT_RPATHS=1;;
esac
done
shift $((OPTIND-1))
cp `which true` .
DYLD_PRINT_LIBRARIES=1 \
DYLD_PRINT_LIBRARIES_POST_LAUNCH=1 \
DYLD_INSERT_LIBRARIES=$1 \
./true
rm ./true
where a the script may be invoked as
my-ldd ./foo.dylib
or (with rpath attempts echo'd)
my-ldd -r ./foo.dylib
Try setting these environment variables before running matlab:
export DYLD_PRINT_LIBRARIES=1
export DYLD_PRINT_LIBRARIES_POST_LAUNCH=1
export DYLD_PRINT_RPATHS=1
Run man dyld
for more possibilities.
You can also set the variables for just the matlab command like this:
DYLD_PRINT_LIBRARIES=1 DYLD_PRINT_LIBRARIES_POST_LAUNCH=1 DYLD_PRINT_RPATHS=1 matlab