HHHHq ~ “Hack”

A blog about programming and…

Archive for the ‘mac’ tag

otool: OS X equivalent of ‘ldd’

without comments

I rarely do C++ development anymore, but today I had to dig around in some of our C++ code; I’m modifying the build to produce some new artifacts.  I work primarily on a Mac and secondarily on Linux.  Those familiar with Linux development tools probably know about ldd — it’s a simple tool that displays the shared libraries a given executable (or other library) depends on.  I was wondering if OS X had an equivalent… and it does: otool.  otool does a bit more than ldd, but if you just want to print dependencies like ldd does then try: otool -L file . For instance,

me@hubble:~$ otool -L /bin/bash
/bin/bash:
	/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

And on Linux, using ldd, you get:

me@galileo:~$ ldd /bin/bash
	linux-gate.so.1 =>  (0xb8095000)
	libncurses.so.5 => /lib/libncurses.so.5 (0xb8052000)
	libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb804e000)
	libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7eea000)
	/lib/ld-linux.so.2 (0xb8096000)

For a list of other under-used OS X command line tools, check out Mac OS X Hacking Tools.

Written by James Royalty

June 1st, 2009 at 1:30 pm

Posted in Programming

Tagged with , , ,

Xcode and environment.plist

without comments

For some reason I always launch certain applications via Spotlight as opposed to just dragging them to the dock and clicking on them there.  One such application is Xcode.  I’m not in Xcode every day (I’m normally writing stuff in Java and use Eclipse) so I guess it kinda makes sense.

Anyway…  Apparently, if you start Xcode via Spotlight your ~/.MacOSX/environment.plist file isn’t read. No doubt, something to do with how processes are launched via Spotlight. (Or rather, who launches them.)  I didn’t dig any deeper because I’ve got some work to do. :)

So there you have it.

Written by James Royalty

April 1st, 2009 at 9:16 pm

Posted in Programming

Tagged with , ,