Shut Down Your Mac via Terminal

First, you have to open Terminal (or any alternative you normally use). Press Command+Space to open Spotlight Search, type “terminal,” and then select it from the search results.

RELATED: What to Do When Your Mac Won’t Shut Down

With terminal open, you’re ready to shut down your Mac. You’ll use the “sudo” command here; otherwise, you’ll be greeted by the error message shown below.

RELATED: How to Control sudo Access on Linux

The sudo (superuser do) command, by default, gives you superuser security privileges.

To shut down your Mac, type the following command:

sudo shutdown -h

Replace

Press enter and type your password when prompted.

Your Mac will now shut down at the time you specified.

Restart Your Mac via Terminal

Aside from one small change, the restart process in Terminal is identical to shutting down. Press Command+Space to open Spotlight Search and search for Terminal.

RELATED: The Best “Just For Fun” Tricks Hidden in macOS’ Terminal

When Terminal opens, type sudo shutdown -r

Replace

Type your password and your Mac will reboot at the time you designated.

Other Command Prompt Shutdown Switches and Parameters

The two methods we covered above are only two of the many ways you can shut down your Mac in Terminal. Below, we’ve included the complete list of shut down switches and descriptions from Apple.