Search code examples
macosstaticunix-ar

How to observe the content of static lib in mac OS?


I create a static library project in my xCode and build a .a named mylib.a. There some code (.m files) and another static lib file named common.a to inform the static library nylib.a. But I doubt that if the contend of common.a are pack in the mylib.a really. So how can I observe the content of the mylib.a in mac OS? I knew there are some command such as ar, nm to complete this task in Linux. but It does't run in mac OS.


Solution

  • "nm" most certainly does exist on the Mac (in the "/usr/bin/" folder).

    If you do not see it there, then you probably need to install the "Command Line Tools for Xcode" that you'll find at https://developer.apple.com/downloads/index.action (you'll need an Apple Developer login to get access to this).

    "nm" will dump all the symbols in a static library file for you. Here is the manual page for it.