How to shut down your mac using terminal
Carter Sullivan
Published Mar 29, 2026
If you shut down your Mac in Terminal, you get more options and flexibility than using the shutdown option in the Apple menu or the power button. Here’s how you do it!
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.
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.
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 with the specific time you want to shut down your Mac. If you want to do so immediately, type now . If you want it to shut down in an hour, type +60 .
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.
When Terminal opens, type sudo shutdown -r . Again, you must use the sudo (superuser do) command to access superuser privileges, or you’ll get the “not super-user” error message.
Replace with the specific time you want your Mac to restart. If you replace with now , it initiates an immediate reboot. If you want it to reboot in an hour, type +60 .
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.
If you own an advanced Mac for business or personal use, chances are you may want to shut it down directly from the command line. This comes handy when you need to remote control your Mac, especially in conditions when you Mac device is booted with the Single User Mode or circumstances of systems administration and troubleshooting. Read on to learn how to Shutdown Mac from terminal easily.
There are many methods that you can use to completely shut down a Mac using the command line. In this article, we will tell you about the two easiest methods.
The Mac Terminal listens to a lot of commands to manage a plethora of tasks and system functions. So, it is but obvious that the command line also comes with methods to easily shut down a Mac computer from the Terminal.
Please bear in mind that the shutting down of the Mac device using the command line method takes place almost immediately. There’s absolutely no warning dialog, no confirmation or any way to stop the process after the command has been given. So, any unsaved data will be lost if the apps close suddenly.
How to Shut Down a Mac from Terminal
The shutdown command helps you to shut down as well as reboot a Mac using the Terminal. If you want to close down all the operations and shut down Mac then you will need to use the h flag and give it the command to shut the system immediately. So, the syntax line will be something like this – sudo shutdown -h now
When you hit the return button and validate the command, the Mac will come to a halt and forcefully stop all the processes and applications. There will no dialog or warning before the action takes place.
Unless you have actually logged in to the computer as the root user, you will need to preface the shutdown command by adding ‘sudo’ which means this needs an administrative password.
To shutdown Mac from terminal follow the steps given below:
1. Open the Terminal on you Mac OS device.
2. Enter the following syntax command below:
sudo shutdown -h now
3. When you are done, you can simply hit the return key and then authenticate the command using an administrative password to enable you to immediately shut down the Mac.
How to Shutdown Mac from Command line After Certain Time
If you want to shutdown a Mac from Terminal after a specified time, you can do that easily using the command below:
sudo shutdown -h +60
After that, you will be asked to enter your password and confirmation that your Mac will be powered off in 60 minutes (in our case).
Your Mac will be powered off after 1 hour (60 minutes). You can replace the “60” number with any number converted in minutes.
Power off Mac from Terminal using the ‘halt’ Command
If you want to shut down the Mac device immediately, you need to give the ‘halt’ command to do so. Below we have given the process and syntax that can be used to close down a Mac. To do this you need to first open the terminal app in your Mac OS device. The command will be:
When you are done, simply hit the return key and then validate the sudo to instantaneously shutting down the Mac. It’s entirely up to you whether you want to use the ‘shutdown’ or ‘halt’ command as it’s all up to preferences.
We hope the above two methods help you shutdown a Mac from Terminal almost instantly.