How to debug .app that only successfully launches from Terminal? Recently, my Dropbox.app stopped launching correctly. If I double-click on the app or try to launch via spotlight, the app just silently dies within a second. I see it show up in Activity Monitor, but no messages are printed if I watch Console. There's no warning or error dialog.

If I use Terminal to issue something like:

open Dropbox.app


then it runs correctly.

I suspect my launch environment got messed up (perhaps python?). But I have no idea how to debug this since Console is revealing nothing.

What are some steps to debug an app that silently dies?

Is there a systematic way to toggle all environment preferences that are causing open Dropbox.app to succeed from Terminal?
You could start by tracing the executable:

% sudo dtruss /Applications/Dropbox.app/Contents/MacOS/Dropbox


It may be loading the wrong python, etc.  Sometimes a trace will give you a clue as to where your app is crashing, esp. if you only have an executable.

You can also look at how the executable was linked, maybe it's finding the wrong version of a library (ldd on linux, otool on osx):

% otool -TVLrH /Applications/Dropbox.app/Contents/MacOS/Dropbox