Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know that there is a command that lists me the libs and respective versions a software was linked against.

Something with ld or libtool?

But I just cannot remember. Spent some time on google but didn't come up with anything useful.

share|improve this question
up vote 21 down vote accepted

Try ldd binary-exec


~$ ldd /bin/bash =>  (0x00606000) => /lib/ (0x00943000) => /lib/tls/i686/cmov/ (0x00c5d000) => /lib/tls/i686/cmov/ (0x003e9000)
    /lib/ (0x00a41000)
share|improve this answer
Dang! So my first try was right. Just need to install it on my Mac so it acutally knows the command ;-) – er4z0r Jan 30 '11 at 15:45
@er4z0r: FYI, Mac OS is BSD, not Linux. – grawity Jan 30 '11 at 19:17
grwaity: you are right. While ldd would help on linux I found that 'otool -L <binary>' does something similar. – er4z0r Jan 30 '11 at 20:56

To find what it directly needs:

readelf -d APP | grep NEEDED

ldd as mentioned elsewhere will show all direct and indirect libs - everything it needs at runtime. This may not be a complete list, since you may dynamically open things with dlopen(), but this should work 99% of the time.

ld and libtool are used at compile/link time. They aren't useful once you have an app.

EDIT I can see by later answers you were asking about OSX, but I want to add to my answer on Linux tools:

One thing I forgot to mention, quite a while ago; you asked about versions. Neither ldd nor readelf will answer the "what version" question. They will tell you the filename of the library you are looking for, and the naming convention may have some version info, but nothing enforces this. Symbols may be versioned, and you would have to much about even lower level with nm to see these,

share|improve this answer

Another way would be to use objdump.

objdump -x "binary" | grep NEEDED

This shows all needed dependencies only for this binary. Very useful.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .