On Linux, an application can easily get its absolute path by querying /proc/self/exe. On FreeBSD, it\'s more involved, since you have to build up a sysctl call
/proc/self/exe
This is late, but [[NSBundle mainBundle] executablePath] works just fine for non-bundled, command-line programs.
[[NSBundle mainBundle] executablePath]