How to find which shared library is loaded by a process on OSX?

Solution 1:

You can set DYLD_PRINT_LIBRARIES=YES in the environment to have dyld print every dynamic library that it loads into the process:

$ DYLD_PRINT_LIBRARIES=YES /usr/bin/true 
dyld: loaded: /usr/bin/true
dyld: loaded: /usr/lib/libSystem.B.dylib
[ ... snip ... ]
dyld: loaded: /usr/lib/libc++.1.dylib
dyld: loaded: /usr/lib/libDiagnosticMessagesClient.dylib
$

Solution 2:

One program that can show which dylib files have been used to execute a program is otool.

otool -L /path/to/program