Can a sandboxed Mac App Store app schedule power-on from shutdown and automatic shutdown?

Hello,

I am developing a native macOS utility using SwiftUI and AppKit, and I am investigating whether its power scheduling features can be implemented in a sandboxed app distributed through the Mac App Store.

The intended functionality is:

  • Schedule power-on from a fully shut-down state, not just wake from sleep.
  • Schedule wake from sleep and shutdown.
  • Let the user select weekdays and times, and modify or cancel the schedule.
  • Keep the schedule effective after the user quits the app.

For example, the user could explicitly configure power-on at 08:00 and shutdown at 22:00, Monday through Friday.

My local prototype uses pmset with administrator authorization. For a possible Mac App Store version, I am looking for a supported implementation that does not execute privileged shell commands or run an application helper as root.

What I have checked

The documentation for IOPMSchedulePowerEvent states that it must be called as root. Calling that API directly therefore does not appear to remove the privilege requirement.

App Review Guideline 2.4.5 requires sandboxing and prohibits requesting escalation to root privileges.

I also reviewed launchd scheduling and user-supplied scripts through NSUserAppleScriptTask, but neither appears to provide a self-contained solution for scheduling power-on from shutdown without privileged operations.

Questions

  1. Is there a public API or system-mediated authorization mechanism that supports this functionality from a sandboxed third-party app?
  2. Is there a requestable entitlement specifically applicable to power-event scheduling?
  3. If the complete feature set is unsupported, which operations are available within App Sandbox: power-on from shutdown, wake from sleep, and scheduled shutdown?

The current deployment target is macOS 13 or later, on Apple silicon and Intel. If a supported solution requires a newer macOS version or specific hardware, that information would also be helpful.

I am asking about supported API capabilities and architecture, rather than advance App Review approval. A documentation reference—or confirmation that scheduled power-on from shutdown is unavailable under these constraints—would help me choose the appropriate distribution model.

Thank you.

The documentation for IOPMSchedulePowerEvent states that it must be called as root.

Correct. In general, most API that effect the entire system (not just a specific user) require root and/or some form of privilege escalation.

My local prototype uses pmset with administrator authorization.

Among other reasons, this is because pmset is calling IOPMSchedulePowerEvent.

Is there a public API or system-mediated authorization mechanism that supports this functionality from a sandboxed third-party app?

Not really. More specifically, there are two different mechanisms involved here:

  1. The Sandbox™ which constrains the kinds of actions your process is allowed to make.

  2. The "root" requirement of IOPMSchedulePowerEvent.

It's worth understanding that these two completely systems that aren't connected or even really "aware" of each other. I haven't looked into it in detail but, assuming #1 is involved at all, its restricting your processes ability to connect to the kernel as part of a blanket restriction against "arbitrary" mach port connections and that restriction probably could be bypassed.

The problem is that getting past #1 wouldn't actually change anything. The second check is an authorization check in the kernel which simply cannot be bypassed.

Is there a requestable entitlement specifically applicable to power-event scheduling?

No. The is significantly older (macOS 10.3) than our entitlement architecture and there's never been a large scale need to integrate it into the modern entitlement architecture.

If the complete feature set is unsupported, which operations are available within App Sandbox: power-on from shutdown, wake from sleep, and scheduled shutdown?

I don't think any of those are really supported by the standard App Sandbox.

__
Kevin Elliott
DTS Engineer, CoreOS/Hardware

Can a sandboxed Mac App Store app schedule power-on from shutdown and automatic shutdown?
 
 
Q