How to automatically shut down your Mac at a specified time
With the Terminal, you can have a wide variety of control when it comes to shutting down your Mac. Most of the time, you'll probably want to shut down your Mac instantly, but other times you may want to shut it down at a specific time, or after a specific number of minutes or hours have elapsed.
This can be useful for times when you want to leave your Mac performing a task, but then have it shut down after the task will be completed while you walk away from the computer. Continue reading and we'll show you how this shut down task can be used in the Terminal.
Begin scheduling the shut down of your Mac by opening the Terminal app (located in /Applications/Utilities) on your Mac.
If you want to shut down your Mac after a certain number of minutes — say, 10 — then type the following command:
sudo shutdown -h +10
This specific command will begin the shut down process of your Mac after 10 minutes, but you can replace the "10" in the above command with any number of minutes you desire. (Note: Because this command requires super user privileges, you will need to input the administrator password before the command is processed.)
Once the command has been run, the Terminal will display the time of the next shut down. If you close the window, or press Control + C inside of the window, the shutdown command will be canceled.
Source: Techradar all