I sometimes shut down my Mac, and I cannot wait it shuts down because I am urgently requested to do something in another office that would require some hours. In some cases, an application that opens a dialog box asking if I really want to close the application blocks the shut down, and when I return I find the Mac still on.
Is there a way to force the Mac to close any applications, instead of blocking the shut down?
Add a comment
|
1 Answer
All you need is to open Terminal.app and type:
sudo shutdown now
That way the system will be forced to terminate all open programs, ignoring any unsaved file changes.
So, in order to be able to launch it via the desktop, you need to open Applescript editor, and type:
do shell script "shutdown now" with administrator privileges
Save the script as an Application, and drag it in your Dock, or somewhere where you'll find it instantly.
-
2+1 for terminal and the often-underused Applescript variation, which are both perfect. I would, however, suggest that you introduce a confirmation dialogue if you put this Applescript application in your Dock (to avoid ruining your day if you accidentally clicked it)!– msanfordApr 19, 2011 at 13:10
-
1@msanford Thank you! The applescript will ask for your password, so if you changed your mind or accidentally clicked it, then you may just click on cancel!– nucApr 19, 2011 at 13:11
-
Nuc, but of course it will ask with "with administrator privileges". Duh. Problem solved and caveat retracted. ;)– msanfordApr 19, 2011 at 16:27
-
Or you could make a shell script with the code 'sudo shutdown -h now'. Once that is made you will need do run
chmod +x /path/to/script
. Then you can double-click it to run the command. This is more efficient because it runs the command directly without running AppleScript first.– iProgramSep 19, 2015 at 20:30