'Trigger "application quit unexpectedly" popup when OS X deamon crashes

I'm working on a new OS-X Daemon process (run from launchd) and would like to get popup window every time it crashes with all relevant information (pid, path to crash file, etc...). This will sure help my debugging effort in this early stage of the development.

Basically, i want to have the same behavior as a UI application. For example : enter image description here

I've made some research and found out about the CrashReporter, but i don't know how to register my app to this service. But it seem like there's no way to trigger popup windows from this service, since crashes are system level events and apps have zero interaction with those.

Maybe there's a way to do so by setting up some parameters in app bundle or via Info.plist ?

EDIT: looking at the crash report manual, it looks like the unexpected dialog works only on GUI user mode, and not on daemon that runs from launchd. perhaps i'm missing something ?

In addition, if the program that crashed is running as a logged in GUI user, CrashReporter will present the user with a dialog asking them whether they want to submit a bug report to Apple (see Figure 1). If the user clicks the Report button, CrashReporter displays another dialog that shows the details of the report (see Figure 2) and allows them to comment it before submission.

I've read that Developer option enable in addition to application crashes, crashes are also displayed for background and system processes. but unfortunately i doesn't work for me.

thanks



Solution 1:[1]

Seems like the problem occurs since my background process runs under root privilege, and root privilage process (not just daemons) cannot initiate any UI widget on the screen.

I guess that the only way to deal with it, is by catching the signal that trigger the crash, and send details for a proxy process that run on non-root mode and can initiate the UI dialog box with crash details.

I would be happy to hear for better proposals.

Solution 2:[2]

Since CrashReporterPrefs, which allowed you to enable this behavior for daemons, no longer comes with developer tools, you can change the behavior to show the dialog for daemons by running this command in the Terminal:

defaults write com.apple.CrashReporter DialogType Developer

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zohar81
Solution 2 lensovet