When shutting down, how to automatically override an app prompt that interrupts the process? [duplicate]

I could not find any relatively simple way to log out of a public use Mac quickly with many tabs open and unsaved document in the background without resorting to sudo shutdown -h now.

The reason I ask is that sometimes a user will have his/her account logged into the iMacs here at school and they would try to log off and then leave, thinking it has completed but the process is interrupted by Safari and Office apps, leaving their account, mounts, and websites still accessible to the next person who sits down.

Obviously a shortcut string would be nice instead of posting a note telling the person to type arcane things in a terminal. For example, just having them try to find Terminal.app is going to be a chore.

This doesn't seem to make sense because the user can just quit each app and click a few dialog boxes but unlike you and I to whom repeatedly pounding Command-Q while hitting the spacebar and D keys are probably second nature.


At my college, they had an app in the Dock whose icon was a white square with LOG OUT in big red letters. It ran a script (put together with appify or similar) that killed all running apps and logged the user off. This also helped with people who didn't know the Mac and didn't look in the Apple menu for the logout menu item.


You could create an AppleScript application, saved to the Desktop or other prominent location, that says

  do shell script "sudo shutdown -h now" with administrator privileges

The user double-clicks the shutdown script, gets a dialog box prompting for the password, and if it is correct, the shutdown proceeds. Note that this only works for accounts with administrator privileges.


There's also the shortcut Command+Shift+Option+Q to log out without confirmation, but it doesn't help when you have unsaved documents pre-10.7; it just avoids needing to hit Command+Q repeatedly. However, with Lion's Resume feature, this works as intended - leaving unsaved documents for the next time you log in.


You can use a third party program like Power Manager to automatically log out inactive users. Power Manager will quit any running applications and will deal with applications that attempt to block the process with sheets or dialogs.

Power Manager - automatically log out inactive user

Disclosure: I work for DssW, the makers of Power Manager.