Execute Custom Script During Power Nap on MacOS 10.8

applescriptautomationmacospower-nap

Apple new feature of OS X 10.8 in new Macs "Power Nap" checks email and does make backups.

Is it possible to execute a custom script (bash, AppleScript,…) when OS X 10.8 is in Power nap mode? For example pull a git repository or download files.

Best Answer

As far as I know, it's not possible.

The reason is that Power Nap doesn't have an API that 3rd party apps can hook into (so apps could trigger a wake event or be notified when one occurs).

Whether this will remain like that in the future depends upon Apple. It would be interesting to see if there's a simple way to detect when one is in power nap mode, but doesn't seem to be available afaik.

If you leave a script that pulls from git every minute, in theory, since Power Nap is really a power on without graphics and audio state, maybe it would get executed (if it was running before). untested.

More info: https://stackoverflow.com/a/11692367/2684