How to make your Mac automatically restart after a crash or power outage

Do you need your Mac to keep running, no matter what? You might want to make sure that if your computer crashes or there’s a brief power outage in your area and you aren’t near your Mac, it restarts on its own.

With a simple Terminal command or flip of a switch in System Settings, you can make your Mac automatically restart after a crash or power failure, and this tutorial shows you how to do that.

MacBook Screen with Terminal Command

Terminal command to automatically restart your Mac

Open Terminal, enter the following Terminal command into the window, and then hit Return.

sudo systemsetup -setrestartfreeze on

Enter your password, hit Return once more, and that’s it. You should never have to enter this command again.

Terminal Command Automatically Restart Mac

To turn off the automatic restart, use the following command.

sudo systemsetup -setrestartfreeze off

And to check the status of your automatic restart, enter this command.

sudo systemsetup -getrestartfreeze
Terminal Command Restart Status Mac

Use System Settings

You can set your Mac desktop, like Mac mini, to turn on automatically after a power outage. Here’s how:

  1. Open System Settings and select Energy Saver.
  2. Turn on the switch for ‘Start up automatically after a power failure.’
Set your Mac to Start up automatically after a power failure

Extra info: With certain UPS models that plug into Mac’s USB port, you can set when your Mac shuts down while using UPS power.

Terminal commands to keep your Mac on

Let’s say you want to keep your Mac on for a certain amount of time without going to sleep, for instance. Instead of opening System Settings or System Preferences and making changes in Energy Saver, just use the following command.

caffeinate -t [seconds]

So, if you want your Mac to stay on for, say, an hour, enter the number of seconds for one hour:

caffeinate -t 3600
Terminal Command Keep Mac On One Hour

You can also use the following command to keep your Mac on permanently as long as the Terminal is running:

caffeinate

To stop a “caffeinate” command, use the keyboard shortcut Control + C in the Terminal window.

Having your Mac restart automatically after a crash or keeping it on when you need it most are both easy to do with simple Terminal commands.

Let us know in the comments below if you plan to use the automatic restart command for your Mac.

Check out next: