Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

when a user presses the shutdown form the menu which process or file is called in return of this to shutdown the mac os

also the directory path of the process


share|improve this question
I'm guessing the shutdown process is called at some extent, but I'm wondering why you're asking this question in the first place? – user3463 Jan 28 '11 at 8:02
i need to call this process with some other source instead off shutdown menu button – Badr uz Zaman Jan 28 '11 at 9:19
It would be useful if you edited your question to instead ask "how can I invoke Mac OS X shutdown programmatically". – Daniel Beck Jan 28 '11 at 17:49
up vote 2 down vote accepted

Execute from the command line, or call osascript some other way with these arguments.

osascript -e 'tell application "Finder" to shut down'

Apple has a Technical Q&A about programmatically restarting, shutting down, or logout. (Thanks @NSGod)

share|improve this answer
This is like the normal GUI-induced shutdown, e.g. canceling the prompt for unsaved documents will cancel shutdown. According to your question, this is the behavior you want. If not, shutdown -h now. – Daniel Beck Jan 28 '11 at 9:38
thanx it is absolutely the thing i required – Badr uz Zaman Jan 28 '11 at 15:15
Technically, telling the Finder to do this is deprecated; you should use System Events instead. That said, the end result of either method is basically kAERestart being sent to kSystemProcess (loginwindow). – NSGod Jan 28 '11 at 20:11
@NSGod Well, it's part of the Legacy Suite, but I didn't find deprecation mentioned in the ASE Library. And it's shorter to type than System Events. – Daniel Beck Jan 28 '11 at 20:13

sudo halt or sudo reboot also work. Read halt(8). AFAIK you'll have to be root because the /sbin/ directory where those programs reside isn't (shouldn't be) in your PATH by default.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .