I left my computer sleeping but turned off the power by accident. Hours after the power was turned back on the computer booted itself up. It is plugged into a UPS. I don't understand how this could happen.
Is the "start on power" selected in the system preferences? if so it will start on getting power...– Solar MikeDec 31, 2018 at 8:54
December 30, 2018. Skynet becomes self aware.– TerminatorJan 1, 2019 at 1:07
On the iMac, there's a setting under System Preferences > Energy Saver called Start up automatically after a power failure, which I'm guessing will be selected on your system, and hence would explain your computer's spontaneous rebooting.
If you don't wish this to happen in the event of a power failure, or the next time you turn off the power by accident, then uncheck that particular option.
Note: Screenshot taken on macOS 10.12.6 (Sierra)
As Tetsujin very helpfully points out in the comments below, there is also a button in the bottom right of the Energy Saver preferences pane labelled "Schedule...", which allows the user to regulate when the computer starts up, wakes up, or goes to sleep. It would be wise to double check your settings there too.
1There's also the Schedule, bottom right, which could potentially explain why it switched on hours later.– TetsujinDec 31, 2018 at 9:09
1Thanks @Tetsujin. I misread the OP as saying "Hours_later_, the power was turned back on...". I'll add your comment to the answer, as it's a very pertinent detail.– CJKDec 31, 2018 at 9:29
1There is also the remote possibility that the UPS spent the first few hours recharging before pushing power to the Mac, but I don't know enough about UPS to know if that's a valid suggestion.– TetsujinDec 31, 2018 at 9:33
@Tetsujin yes, for a ups that can happen - depends how it can be configured... sure the answer will get updated to include that... Dec 31, 2018 at 10:56