Reboot Mac OS X from the Command Line

Sep 6, 2012 - 8 Comments

Reboot Mac OS X from the Command Line

Rebooting a Mac from the command line is fairly simple, though most users are best served just using the standard  Apple menu method. Nonetheless, using the terminal command can be an invaluable trick for troubleshooting purposes, remote systems administration and management through SSH, and a number of other reasons.

From the OS X Terminal type the following:

sudo shutdown -r now

Enter the administrator password when requested in order to use sudo.

The Mac will be immediately restarted regardless of what’s going on, so be sure not to use this if important documents are open and you have something like auto-save turned off.

You can add a message to the reboot notice for those logged in through SSH by adding a quote at the end like so:

sudo shutdown -r now "Rebooting Now for"

This looks like the following to anyone logged into the Mac:

Shutdown NOW!

*** FINAL System shutdown message from user@hostname ***
System going down IMMEDIATELY

Rebooting Now for

System shutdown time has arrived

The reporting will reference shutdown whether you are rebooting, shutting down, or sleeping, which is why it can be useful to append a message to the command, which is reported back as the second to last line. Also, the “user@hostname” will be that of whom initiated the reboot.

Using this shutdown command, it would also be easy to modify a past trick to remotely sleeping a Mac to be able to remotely reboot or shutdown a Mac instead.

The shutdown command has been around since the earliest days of Mac OS X and still exists in Lion and Mountain Lion onward. As you may have guessed, the shutdown command can be used for other tasks like actually shutting the Mac down, putting the Mac to sleep instantly like pmset, and more.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: William Pearson in Command Line, Mac OS X, Tips & Tricks, Troubleshooting


» Comments RSS Feed

  1. parakeet says:

    For sysadmins why not use a single command instead of logging in then issuing the command?

    ssh user@hostname sudo shutdown -r now “rebooting your Mac”

    Then you only have to enter the admin password once.

  2. Rick Blythe says:

    Why not just use:

    sudo halt

  3. Austria says:

    “sudo reboot” does the same

  4. Phil says:

    Don’t forget shutdown -h now for halt

  5. Bill Eccles says:

    Use “sudo reboot” unless you want a forgotten “-r” option to cause some unintended travel.

Leave a Reply


Shop for Apple & Mac Deals on

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates