5

I want to have a Mac Mini automatically boot when power is applied, as I cannot conveniently reach its power button, because it resides inside an art installation, where the power will be shut down during the night. I thought it might be possible to use the "Start up automatically after a power failure" in the energy system settings for this, along with the -u parameter to the shutdown command, in order to safely bring the machine in a state where I don't have to fear data loss. According to the shutdown man page, the -u parameter seems to be what I need:

-u: The system is halted up until the point of removing system power, but waits before removing power for 5 minutes so that an external UPS (uninterruptible power supply) can forcibly remove power. This simulates a dirty shutdown to permit a later automatic power on. OS X uses this mode automatically with supported UPSs in emergency shutdowns.

But shutdown -hu now does not work. On both Macs I tested it with (Mac Mini with 10.10 and a Mac Pro on 10.11), the machines still power off immediately, they do not wait for five minutes in the halt state, so that I don't have the time to power off the mains. Therefore, the autostart on power failure setting doesn't trigger, and I have to manually push the power button to make them boot again.

2
  • Do you have UPS physically connected while you are testing? I would expect things to fail if there isn't a USB connection to a working power supply.
    – bmike
    Jan 13, 2016 at 19:28
  • I'm having the same problem. I was using the dirty shutdown command on my Mac mini, but after updating to El Capitan it stopped working (as you described). I was using the iHome Smart Plug to kill power after the dirty shutdown and to provide power again later for automatic boot. Since OS 10.11 came out, I have to manually press the power button on the Mac, which negates the reason for using the iHome Smart Plug.
    – user170079
    Feb 13, 2016 at 2:40

3 Answers 3

3

The NVRAM setting to power on when power returns has nothing to do with the shutdown command, so I wouldn't worry about the shutdown options and instead focus on the NVRAM settings for what to do when the machine senses a return of power.

If you don't have an actual UPS - I would get an internet enabled power switch like WeMo or other or just train staff to power cycle the hardware.

The setting to power on automatically is quite reliable in my experience, so you should only need that to recover from 95% or more of the power failure events you have. Also, kiosk machines generally just run apps and open files, so you don't have work that needs to be saved to disk. I would just let the power cut from the Mac and make sure the filesystem is journaled so that the restart is quick.

enter image description here

If you have an actual UPS - use the energy saver control panel to tell the OS to shut down N minutes before the power runs out and you will be well protected from data loss.

enter image description here

Here I have a server with storage attached so I'm having the shut down scheduled 10 minutes before the battery expires. For a kiosk, I would disable all three sliders/check boxes for UPS or get a simple UPS like APS BGE70 that lacks USB port entirely and just gives you some time when people accidentally trip the power or a substation feeder shifts and your outage is a minute or so in length.

3
  • Am I right that the "NVRAM setting" you're talking about is the "Start up automatically after a power failure" I was using? Jan 13, 2016 at 19:35
  • 1
    yup - both my Mac Pro and Mac Mini seem to power off with -u so if you want to file a bug with Apple - that might be worthwhile - but the end result is still fine for my needs. They power off when the battery runs low, they restart if and only if power is actually cut and then returns. You roll the dice on UPS shutdowns if the power comes back between the time you issue the shutdown and the power stays connected. For kiosk use, I just let it crash hard to ensure it powers back on. Journaling keeps the boot short and data doesn't really change on a kiosk so data loss is a rare event.
    – bmike
    Jan 13, 2016 at 19:39
  • OK, so there is no other NVRAM setting that better fits my problem? And if I can't get apple to fix the probable bug with -u, the only other (still partial) solution is to buy a UPS and hope that it works with your suggestion? If so, I will probably go with the power off hard crash and hope that there will be no data loss... Thanks @bmike for the quick explanation! Jan 13, 2016 at 19:46
1

So in 2020 this exact scenario does work for me

  • a 5,1 Mac Pro running 10.11,
  • set to "restart after a power failure"
  • ran the command sudo shutdown -hu now
  • machine shuts down quickly - and the power light does go off, but ..
  • shutting the power off and on results in the machine starting up again

So, either some other part of the power system stays on after the power light goes off, or the system just doesn't record this as a "clean" shutdown (I haven't done a full 5 minute wait test to see, but it seems to work as documented for me)

-1

Found a workaround for "auto boot after power loss" on any OS, after few H/w tests, found that "BIOS"(or whatever they named it in APPLE) controlled by OSX OS - basically changing this setting under Power Saving - "Start up automatically after a power failure" to enabled and then wipe the local HDD and install anything you want that won't affect this setting(meaning it will remain and will power the box back on after power failure), and vise versa - removing this setting via OSX will cause Mac stop "Auto start after power failure" running no matter what OS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .