Apple - Possible to run scripts on sleep and wake?

SleepWatcher may be of use.

From the description: It can be used to execute a Unix command when the Mac or the display of the Mac goes to sleep mode or wakes up, after a given time without user interaction or when the user resumes activity after a break or when the power supply of a Mac notebook is attached or detached. It also can send the Mac to sleep mode or retrieve the time since last user activity.

It's working fine for me on 10.6.8. Various versions are available to support 10.1(!) thru 10.7


It appears that as the OS ships, sleep/wake cannot trigger scripts, but third party solutions have been developed.

  • Scenario appears to be one such solution.
  • Power Manager also seems to add some script triggering abilities. I can see it can trigger scripts on wake from sleep and it can trigger scripts on sleep. Power Manager - trigger on power on screen shot

I have no personal experience with these programs or their vendors.


This is my own app, so consider that, but ControlPlane has the ability to do actions based on Sleep/Wake. You'll find it at http://www.controlplaneapp.com/.

ControlPlane is a fork of MarcoPolo and has been updated to run on Snow Leopard and Lion.