ldd on Mac OS X

I was used to use ldd on Linux and Solaris to print out the dynamic library linkage.

However, there is no ldd on Mac OS X but a equivalent tool called otool.

Here is the usage:

Usage: otool [-fahlLDtdorSTMRIHvVcXm] <object file> ...
	-f print the fat headers
	-a print the archive header
	-h print the mach header
	-l print the load commands
	-L print shared libraries used
	-D print shared library id name
	-t print the text section (disassemble with -v)
	-p <routine name>  start dissassemble from routine name
	-s <segname> <sectname> print contents of section
	-d print the data section
	-o print the Objective-C segment
	-r print the relocation entries
	-S print the table of contents of a library
	-T print the table of contents of a dynamic shared library
	-M print the module table of a dynamic shared library
	-R print the reference table of a dynamic shared library
	-I print the indirect symbol table
	-H print the two-level hints table
	-v print verbosely (symbolically) when possible
	-V print disassembled operands symbolically
	-c print argument strings of a core file
	-X print no leading addresses or headers
	-m don't use archive(member) syntax
	-B force Thumb disassembly (ARM objects only)

 

To use it like ldd, just type

otool -L executable

For example:

$ otool -L a.out
a.out:
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0)

Published by

Need-Being

You never know me... Need-Being... Human Being? or Just Being Here...

Leave a Reply

Your email address will not be published. Required fields are marked *