How to Restart Mac (from Terminal)

While shutting down and restarting your computer might sound trivial, and are perhaps obvious tasks in most cases, there are a number of ways to go about doing these on your Mac, many of which you might not be aware of.

Some of the approaches for shutting down and restarting may be preferred in most situations, but others might be better suited when your Mac is unresponsive, or is otherwise in a jam where the standard options are either not available or not working properly.

The Apple menu – The Simplest Method

The Apple Menu has the standard options for shutting down and restarting your Mac.

The standard ways to restart and shut down your Mac are in the Apple menu.

These options will close each program as cleanly as possible, allowing you to save documents and settings, and quitting them only when they are ready.

If a program cannot be cleanly stopped, then it will prevent the shutdown or restart from proceeding. Since they are the gentlest approaches, in most cases you will use these methods for restarting and shutting down your Mac.

The Terminal

Another approach you can use for restarting your Mac is to use the Terminal, where there are several commands available performing these actions:

sudo shutdown -r now

This command will perform a restart on your Mac immediately. You can replace the “-r” with an “-h” to halt (shut down) the system instead of restarting it, and can change “now” to some number to indicate seconds until the shutdown or restart takes place.

In addition to “shutdown,” you can use the “reboot” and “halt” commands in similar manners:

sudo reboot
sudo halt

These commands will be a little more crude when compared to GUI options, as they will force programs to quit instead of stopping the shutdown process if a program is busy.

As a result, they are beneficial to use if the Apple Menu options to not seem to work.

A final Terminal-based option allows you to invoke the standard Restart and Shut Down in the Apple menu, by simply running the AppleScript commands that invoke these reboot actions:

osascript -e 'tell application "System Events" to restart'
osascript -e 'tell application "System Events" to shut down'

These last two are perhaps best to use in scripts for scheduled tasks, but in order to work will require your user account be logged in.

Managing FileVault

Terminal-based approaches can be used for restarting remote systems such as servers; however, if you have FileVault enabled on your remote Mac, then you will run into an issue where the system will restart but then need to be unlocked before macOS can load. Unfortunately without OS X loaded there will be no way to interact with your system and control it.

This problem will occur even if you use Screen Sharing; therefore you need to use the following special command to reboot any FileVault-enabled Mac and have it resume without first needing to be unlocked:

sudo fdesetup authrestart

This command will store your password temporarily for one reboot session, and then restart your system so the disk will be unlocked.

Your Mac’s power button

The last approach to restarting and shutting down is to use the power button on your Mac, which has several modes you can use.

The first is to hold the button for only a few seconds, where you will see the power panel appear with options for restarting, shutting down, or sleeping your Mac (note you can also press Control-Eject on Macs that have an Eject key).

At this panel, you can press the “R” key to restart, or use the tab key to highlight your desired choice followed by invoking it with the Space bar.

Holding your Mac’s power button for 3-5 seconds will reveal the power menu panel, where you can select the same options in the Apple menu.

This approach will invoke the standard Shutdown and Restart procedures as can be accessed from the Apple menu, and will similarly be relatively gentle on programs.

However, this also means that if your Mac is unresponsive and you cannot open the Terminal, then this likewise may not allow you to shut down your system.

Therefore, as a last resort, you can perform a hard shutoff of any Mac by holding the Power key down until the system powers off.

Photo of author


Mac Issues

At Mac Issues, we're dedicated to helping you learn how to use your Macbook properly. With tutorials, how-to troubleshooting guides & real reviews, hopefully we can make your day that little bit easier.

Read more from Mac Issues