4 KB
Includes binary and source

You don't need this anymore. On 10.5 and later, run "pmset sleepnow". man pmset for more details.

What is it?

SleepNow is a Mac OS X command-line tool which puts the machine to sleep, just as though someone had used the Sleep menu command while sitting in front of the machine. The advantage is that SleepNow can be run while logged in to the machine from anywhere on the net.

Security issues

Obviously, putting a machine to sleep is Not Good if someone else is trying to use it. Also, waking the machine up again is your own problem. (Try turning on "Wake for network administrative access" in the Energy Saver options, or look into the wakeonlan program. I am not sure if either of these will work for you.)

Also note that any user may put the machine to sleep, not just an administrator.


Because Dave asked for a way to do this, and it was trivial.
The code was taken from a post on the darwin-development mailing list by Rob Braun. I didn't write it, I just packaged it up.


Please send questions or comments to: krevis@snoize.com