I would like to programmatically wake up a Mac. I started off by using IOPMSchedulePowerEvent, however, that method requires admin access and privileged helpers. I've implemented and it works but is way too complicated.
I've looked around for a better approach and found that you can schedule the system to wake up by going to, System Preferences -> Energy Saver -> Schedule. Is there a way to programmatically schedule a wake up time using this method?
Thanks.
Edit: I understand the system requires admin access to schedule system wakeup and sleep time. That is ok. I would like to be able to do this programmatically. Having the user authorize the functionality is ok provided that they are only asked once. Subsequent requests to set the system wakeup time should not have to require user authorization.
Using
IOPMSchedulePowerEvent
is the right thing to do. However, if you create a privileged helper tool you only need to prompt the user once for his/her password. Apple's BetterAuthorizationSample code provides an example of how to do this; there's also a third-party modification, AuthorizedTasksInCocoa, which might be a bit easier to use (I haven't tried it).