Prevent restarting Mac by accident

I recently tried different keystrokes to regain control of my mouse/keyboard from parallels, and I pressed something that cause my Mac to start shutting down. It didn't prompt me to confirm that I wanted to shutdown my Mac, it just started closing applications for the shutdown.

Question is there a way to require that the use respond to a confirmation dialog before shutting down / restarting their Mac?

Additional info- I was multi-tasking at the time, setting up a Linux KVM host , a Raspberry Pi image , among other things. I almost lost all of my work so I would like to put in a safeguard against accidentally restarting my Mac.


Solution 1:

More than likely, you hit Control⌘ Command and the ⦿ Power button .

That's the only keyboard combination that will force restart a Mac without asking you to save unsaved documents. The only other way to shut down a Mac without it prompting you is to hold the ⦿ Button for 5 seconds.

Question is there a way to require that the use respond to a confirmation dialog before shutting down / restarting their Mac?

There are key combinations that already exist with confirmations:

  • Control⌘ Command⏏ Media Eject - Quit all apps, then restart your Mac. If any open documents have unsaved changes, you'll be asked whether you want to save them. *

  • Control⌘ Command Option ⦿ Power Button or Control⌘ Command Option ⏏ Media Eject - Quit all apps, then shut down your Mac. If any open documents have unsaved changes, you'll be asked whether you want to save them.*

* Doesn't apply to keyboards that have a Touch Bar.

It's probably best that you familiarize yourself with the keyboard shortcuts that are set by default in macOS

Solution 2:

The simplest way to prevent a restart with the fewest resources is to enable fast-user switching and open an active login session.

enable fast user switching

Switch back to your session and, in case of anything but a forced shutdown/restart will show following message:

fast switching restart dialog