Question

It seems to be impossible to completely disable the Sleep option in MacOSX so that a user cannot manually put the system to sleep.

Is there a way in Leopard (or even Snow Leopard) for AppleScript to catch the Sleep event and cancel it?

Was it helpful?

Solution

You can't do this from user mode, because the power manager prevents it, so you'll need to use a kernel extension, such as InsomniaX.

OTHER TIPS

The answer to your problem is however a simple Apple-osx-Terminal command that prevents OSX to go idle:

$ pmset noidle
Preventing idle sleep (^C to exit)...

The only way to reset the no-sleeping is to issue a 'Control-C'.
See the man pages of pmset for more details.

This command has been deprecated in favor for

$ caffeinate -i

Which does roughly the same. You can also run caffeinate for a pre-determined amount of time to prevent sleeping, say for 4 hours while you download something, and then run it in the background by adding & to it:

$ caffeinate -t 144000 &

Newer version(s) of OSX make it more possible to disable certain options according to https://apple.stackexchange.com/questions/35256/mac-os-x-lion-server-how-to-disable-sleep-restart-shutdown-options-for-users

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top