How does being inside an application bundle affect how the binary executable runs?
To explain, I compiled Emacs for Mountain Lion. This produces a binary executable, and also an application bundle, Emacs.app, that contains the exact same binary (same content, according to diff), plus other resources.
If I run the binary itself from the terminal (or finder):
In contrast, if I run the Emacs.app, Emacs runs as expected. Can anyone explain this difference for me please?
When you launch an .app bundle, the Info.plist at the root of the folder configures many OS specific behaviors.
You can launch any native executable this way and have the same behavior.