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

Related to my other question on Windows, how would one go about creating a logoff script for Mac OS X?

share|improve this question
up vote 3 down vote accepted

What do you mean by "logoff script"? If you mean "how to logoff current session from the terminal", then you can do this from any shell script or terminal:

osascript -e 'tell application "System Events" to log out'

If by "logoff script" you mean "a script that is executed when one logs off", then I invite you to read this nice post on that topic (with example scripts):, or see the official documentation here:

Another very nice example:

share|improve this answer
the second, yes - a script that runs at logoff, like the old "Shutdown Items" in the System folder on old version of Mac OS :) – warren Nov 4 '09 at 9:45
Here's another very nice and simple example on login/out hooks: – Zoran Nov 4 '09 at 9:56
would you mind adding that link ( to your answer, so I can accept it? – warren Nov 9 '09 at 16:21
Sure, added the link to the response. – Zoran Nov 10 '09 at 6:22

You must log in to answer this question.

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