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:
sudo halt
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.