I realize that recent versions of MacOS ship with a dynamic library cache. I am looking for inputs on how to list the dependencies of one such system library that's part of this cache.
Consider the case where I have a libfoo library which when inspected through "otool -L libfoo.dylib" shows this output:
otool -L libfoo.dylib
/home/me/lib/libjli.dylib:
@rpath/libjli.dylib (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 23.0.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 60157.60.19)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 56.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1856.105.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1856.105.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
One of the dependencies in that library is the /usr/lib/libSystem.B.dylib
. Previously, I could just do otool -L /usr/lib/libSystem.B.dylib
to find the dependencies of libSystem.B.dylib
, but now with the dynamic library cache in picture, if I do:
otool -L /usr/lib/libSystem.B.dylib
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic: can't open file: /usr/lib/libSystem.B.dylib (No such file or directory)
So how do I get otool to show the dependencies of this cache library. Are there any other tools instead of otool which can do this in recent versions of MacOS?
I'm on 12.3.1 of macOS
On a different thread, Quinn pointed me to the right tool to get this information. Details are available in the reply here - https://developer.apple.com/forums/thread/655588?answerId=712400022#712400022.
In short, using dyld_info -dependents <library>
will list the dependencies.