In case you shut down your Mac in Terminal then, you will get more options and flexibility than using the shutdown option in the Apple menu or the power button. Here’s how to shut down your Mac using Terminal.
Shut Down Your Mac via Terminal
First of all, you have to open Terminal or any alternative you normally that you use. Just press Command+Space to open Spotlight Search and then type “terminal.” After that select it from the search results.
Now with terminal open, you are ready to shut down your Mac. You will use the “sudo” command here; or else, you will 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 <time>
Now replace <time> with the specific time you want to shut down your Mac. In case you want to do so immediately then, type now. If you want it to shut down in an hour then, type +60.
Then press enter and type your password when prompted.
Your Mac will now shut down at the time you mentioned.
Restart Your Mac via Terminal
Apart from one small change, the restart process in Terminal is identical to shutting down. Simply press Command+Space to open Spotlight Search and search for Terminal.
When Terminal opens then, type sudo shutdown -r <time>. Again, you must use the sudo (superuser do) command to access superuser privileges, or else you will get the “not super-user” error message.
Then replace <time> with the specific time you want your Mac to restart. In case you replace <time> with now then, it initiates an immediate reboot. If you want it to reboot in an hour then, type +60.
Now type your password and your Mac will reboot at the time you designated.
Other Command Prompt Shutdown Switches and Parameters
The two methods we explained above are only two of the many ways you can shut down your Mac in Terminal. Below, we have included the complete list of shut down switches and descriptions from Apple.
|Switch and Parameter||Description|
|-h||The system is halted at the specified time.|
|-k||Kick everybody off.The -k option does not actually halt the system but leaves the system multi-user with logins disabled (for all but super-users).|
|-n||If the -o is specified, prevent the file system cache from being flushed by passing -n option to halt(8) or reboot(8).This option should probably not be used.|
|-o||If -h or -r is specified, the shutdown will execute halt(8) or reboot(8) instead of sending a signal to launch(8).|
|-r||The system is rebooted at the specified time.|
|-s||The system is put to sleep at the specified time.|
|-u||The system is halted up until the point of removing system power but waits before removing power for 5 minutes so that an external UPS (uninterruptible power supply) can forcibly remove power.This simulates a dirty shutdown to permit a later automatic power on. OS X uses this mode automatically with supported UPSs in emergency shutdowns.|
|time||time is the time at which shutdown will bring the system down and maybe the word now (indicating an immediate shutdown) or specify a future time in one of two formats: +number, or yymmddhhmm, where the year, month, and day may default to the current system values. The first form brings the system down in number minutes and the second at the absolute time specified.|
|warning message||Any other arguments comprise the warning message that is broadcast to users currently logged into the system.|