Sleep/Wake Events in OS X

In case you wish for certain events to take place on sleep or wake of you Mac, the software sleepwatcher is your friend. You can install it from Macports with the following line:

sudo port install sleepwatcher

To launch it on system startup, do this:

sudo port load sleepwatcher

If e.g. you want to show a login window on wakeup, create an executable file called ~/.sleep with the following contents:

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

Leave a Comment