I am trying to make my software available on macOS, and in my toolchain I use the ldd -r MyModel.so
command to verify that everything went well, but I can’t really find an equivalent command on macOS with the same behavior.
otool
and nm
seem to be the two directions to go, but which of their options provide the behavior of ldd -r
? Is there any other tool that can be used for this purpose?
ldd
uses ld
to load executable files, and recursively loads
dynamically-linked libraries. So using ldd
requires being on the target system
(e.g., Linux). Thus, ldd
cannot be used for ELF files on macOS.
Assuming that the question is about analyzing Mach-O files on macOS, I do not know of any tool that works for Mach-O files as ldd
does for ELF files.
Both otool
and nm
perform a static analysis.
A possibility is:
otool -L /usr/bin/true
Relevant: