Restart after UPS mediated OS X Shutdown?

Hi team,

Have any of you clever people figured out how to have your mac restart after a UPS mediated shutdown?

Our mini is hooked to an APC UPS via USB ( aside from line voltage to run the mac ). Power Management is set to cleanly shutdown the mac when the UPS hits 25% of capacity.

How would I have the unattended, headless mac restart when power is restored?

I'm set w/restarting the wonderful SSpy after the machine boots. that's fine.

Comments

  • There's a checkbox in macOS System Settings -> Energy -> Restart automatically after power failure. Turn that on.

    And then there's the 'pmset' method, ie, in the shell:

    sudo pmset -a relative poweron 60

    That means, when the computer shuts down, power on 60 seconds later.

  • caseyd
    edited December 2025

    Yes, @photonclock that is true. And is what I have done.

    however using the MAC OS UPS controls to tell the Mac to shut down is apparently different than a hard power-off shutdown, and the machine does not wake up.

    This could be related to the philosophy that if your computer has had a hard shutdown it shouldn't automatically restart upon power as the power may not be reliable. therefore manual intervention is thought necessary to avoid machine degradation. sort of an enterprisey thing.

    I'm now browsing switchbots

  • Ben
    Ben
    edited December 2025

    For an ordered shutdown, the "restart automatically after power failure" won't do it. It's going to be tricky to have the subsequent Mac startup tied to the battery level, so one solution could be to set it to power on every day at a set time. This way, you get a daily check whether the battery level has replenished: if the battery level is still too low after starting up, your existing mechanism will shut it down again, and it will try again the next day. For example, here's a Terminal command to set it to power on every day at 9am:

    sudo pmset repeat poweron MTWRFSU 09:00:00
    

    Verify the current scheduled power events like this:

    pmset -g sched
    

    Delete all "repeat" scheduled events like this:

    sudo pmset repeat cancel
    
  • caseyd
    edited December 2025

    ah Ben that's clever. I will give it a try, but I do have some reservations.

    The "Battery Level" will be the one in the UPS the Mac is attending to; so there must be some kind of kernel running if there is any AC power on the line-in... otherwise who's doing the checking?

    if it works I suppose I could write a cron job to run a script to build hourly lines like:

    pmset schedule poweron "today's date ( every hour) "
    pmset schedule poweron "tomorrow's date ( every hour) "
    

    given the randomatic recovery times of power here in NorCal

    My other bit of exploration is to make a Proxmox VM of Sonoma and run SSpy in there. I've had to move my HA instance off a beefy Mini running proxmox due to the lack of 'boot on power on' behavior.

  • In order for my idea to work, the UPS manager software on the Mac must shut down the Mac, but not tell the UPS to cut power. With the Mac shut down and the UPS at 25%, it should use just a trickle until the next Mac's scheduled startup. Then once powered on again, the UPS software should kick in and cause another shutdown if still below 25%. But, perhaps the power management of your UPS doesn't work in the way that I'm imagining?

  • ah interesting wrinkle; I am not sure what the Mac is telling the APC UPS re power. And our outages here in lovely NorCal can be days on end... even these bigger SmartUPS' don't last that long.

    I might get a useful duration w/this scheme if I dedicate a UPS to the SSpy Mac tho. And it won't be flailing moment by moment w/the cron scheme.

    happy new year SpyMaster

  • Please report back when you find a good solution - I'm sure this will be useful for others.

    Happy new year :)

  • I have a mac that I've been turning off almost every day via hard shutdown (power button.)

    Zero ill effects....