Scripting idletime reset ...


I have a script that needs to reset the system idletime variable. I found an utility called «Caffeine» that help me do that. Caffeine suspends the computer’s activity by resetting the idletime variable. Then I simply use these 2 handlers:

on ActivateCaffeine()
	tell application "Caffeine"
		turn on
	end tell
end ActivateCaffeine

on DesactivateCaffeine()
	tell application "Caffeine"
		turn off
	end tell
end DesactivateCaffeine

I wonder if there wasn’t any shell script that could help me do this in a simpler maner ?




I’m pretty sure that you can find some default variables for customizing this setting over at macosxhints.

I just got to add a “thanks” to you for your code, I like caffeine as it is really, but I might use your code, if I were to script some huge downloads or other stuff. There is a great hack over at or some other place (google “lock screen”) which enables you to lock your screen after having disabled sleep, so that you can leave your Mac’s screen password protected while it does some stuff.

The thought that Caffeine was scriptable never struck me. :slight_smile:

Best Regards


Hi McUsr,

Enjoy … I have looked many places to find ways resetting the idletime. When searching I found Caffeine. There should be a way to do this with a shellscript …


Robert Lespérance