Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Gary King

macrumors 6502
Original poster
Jun 14, 2004
495
1
For instance, when I shutdown, sometimes I get the dialog telling me that an app has not quit yet, and can't quit. So I need to click 'ok' on the dialog and re-shutdown.

How do I make OS X automatically just hit 'ok' for those dialogs, and then shutdown? Like, bypass them, without requiring me to explicitly close them.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Assuming you are an Administrator on the machine open Terminal and type:

sudo -u root shutdown -h now

You will be asked for your admin password.

The machine will now halt with no dialogs or warnings.

Be VERY CAREFUL you will not even get prompted to save any unsaved work. Your apps just get killed. If you want to restart not halt substitute -r for -h.
 

domenicop

macrumors member
May 16, 2013
60
13
Assuming you are an Administrator on the machine open Terminal and type:

sudo -u root shutdown -h now

You will be asked for your admin password.

The machine will now halt with no dialogs or warnings.

Be VERY CAREFUL you will not even get prompted to save any unsaved work. Your apps just get killed. If you want to restart not halt substitute -r for -h.
According to sudo documentation
The -u (user) option causes sudo to run the specified
command as a user other than root.
To specify a uid
instead of a user name, use #uid. When running commands as
a uid, many shells require that the '#' be escaped with a
backslash ('\'). Note that if the targetpw Defaults option
is set (see sudoers(5)) it is not possible to run commands
with a uid not listed in the password database.

So why bother putting the -u root option?

PS.I know it's a really old thread but as I found this, others will. :)
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
So why bother putting the -u root option?

PS.I know it's a really old thread but as I found this, others will. :)

Belt and braces: you never know if the default behavior will change (ok in this case I suppose it's very unlikely!). Also if you have a lot of code to maintain then it's much easier to have the exact option right there in the code to look at when you come back years later.
 

Fishrrman

macrumors Penryn
Feb 20, 2009
28,348
12,464
The easiest way to force a shut down the computer is to press the power-on key and KEEP HOLDING IT DOWN for about 4-5 seconds.

The Mac will power off -- no prompts, no nuthin'.
Just…. off.
 

canistel

macrumors newbie
Apr 24, 2013
7
0
The easiest way to force a shut down the computer is to press the power-on key and KEEP HOLDING IT DOWN for about 4-5 seconds.

The Mac will power off -- no prompts, no nuthin'.
Just…. off.

You forgot to mention... "Just disk corruption".

This advice is horrible, please don't repeat that anywhere.
 

Fishrrman

macrumors Penryn
Feb 20, 2009
28,348
12,464
"You forgot to mention... "Just disk corruption".
This advice is horrible, please don't repeat that anywhere."

Your post is nonsense.

The original question was -- how do you FORCE a shutdown, and bypass all dialog windows? That is, when NOTHING ELSE works.

I gave the answer.

Over many years of Mac usage (perhaps longer than you've been alive), I've done this numerous times when no other option seemed possible -- in most cases, the Mac "comes right back up", no problems at all.

How many times have you had a power outage? Does the Mac boot back up?
That's as "forced a shutdown" as one can have. I seem to recall at least a few instances when even the power button didn't appear to work, and I had to reach down and switch off the power strip.

That's one of the strengths of OS X -- that is, its ability to "restore itself" from situations like that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.