How can I find out which program is trying to restart my Mac?
Solution 1:
If you have Xcode installed, you can use Accessibility Inspector (full path below) to find information on any user interface element. Click on the “crosshairs’ icon in the window's menu bar and watch the informative display as you mouse over various UI elements.
In your case, however, it will show what process displayed the dialog, which is not necessarily the process that is trying to restart your mac. But you won't know until you try.
/Applications/Xcode.app/Contents/Applications/Accessibility Inspector.app