• Open Menu Close Menu
  • Apple
  • Apple
Terminal User Guide
打开菜单关闭菜单
  • 社区
  • 联系支持
macOS Catalina 10.15
macOS Mojave 10.14
macOS High Sierra
目录

Restart computers using Terminal on Mac

To restart a computer now or at a specific time using Terminal, you can use the shutdown command or the systemsetup command. The following examples show some ways to use these commands, but for complete information about them, see the shutdown command man page and the systemsetup command man page.

Tip: It’s easier to restart your Mac by choosing Apple menu > Restart, or shut it down by choosing Apple menu > Shut Down. See Log out, sleep, restart, or shut down your Mac.

Restart the local computer

  • In the Terminal app on your Mac, enter the following command:

    % sudo shutdown -r now

Restart a remote computer immediately

  • In the Terminal app on your Mac, enter the following commands:

    % ssh -l admincomputer% sudo shutdown -r now

    Replace admin with the short name of a user account on the remote computer.

    Replace computer with the IP address or host name of the remote computer.

Restart a remote computer at a specific time

  • In the Terminal app on your Mac, enter the following commands:

    % ssh -l admin computer% sudo shutdown -r hhmm

    Replace admin with the short name of a user account on the remote computer.

    Replace computer with the IP address or host name of the remote computer.

    Replace hhmm with the hour and minute you want the remote computer to restart.

Restart automatically after power failure

  • In the Terminal app on your Mac, enter the following command:

    % sudo systemsetup -setwaitforstartupafterpowerfailure seconds

    Replace seconds with the number of seconds before the computer starts after a power failure. This value must be 0 (zero) or a multiple of 30.

Note: You can also use Energy Saver preferences to set a Mac to restart automatically after a power failure.

See alsossh command man pagesudo command man pageOpen or quit Terminal on MacOpen new Terminal windows and tabs on MacExecute commands and run tools in Terminal on Mac
Apple
  1. 支持
  2. Terminal User Guide
  3. Restart computers using Terminal on Mac
新加坡
Copyright © 2019 Apple Inc. 保留所有权利。
隐私政策 使用条款