How to make your Mac automatically restart after a crash with Terminal
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, that it restarts on its own.
With a simple Terminal command, you can make your Mac automatically restart after a crash and here’s how along with a few other Terminal tips.
Open Terminal
Open Terminal on your Mac one of these quick ways:
- With Finder open, click Go > Utilities from the menu bar and pick Terminal.
- Click Applications > Utilities from your Dock and choose Terminal.
- Open Spotlight Search and enter Terminal.
Terminal command to automatically restart your Mac
Now, 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.
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 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 Preferences and making changes in Energy Saver, just use the following command.
caffeinate -t [seconds]
So, if you want your Mac stay on for say an hour, enter the number of seconds for one hour:
caffeinate -t 3600
You can also use the following command to keep your Mac on permanently as long as Terminal is running:
caffeinate
To stop a “caffeinate” command, use the keyboard shortcut Control + C in the Terminal window.
Wrapping it up
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. And remember, you can always visit us on Twitter if you have tips of your own you’d like to share.
Source link: https://www.idownloadblog.com/2019/08/08/mac-automatically-restart-after-crash-terminal/
Leave a Reply