设置macbook pro/air死机后自动重启


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.

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

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

Terminal Command Keep Mac On One Hour

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


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.

类别:技术文章 | 阅读:61299 | 评论:0 | 标签:



taoCMS发布taoCMS 3.0.2(最后更新21年03月15日),请大家速速升级,欢迎大家试用和提出您宝贵的意见建议。