If you ever felt like shutting down your Mac after a time-consuming process has finished, such as downloading and installing updates or exporting a video, what you need is a shutdown timer.
There are some applications on the Mac App Store which already perform these functions, such as Timer Boom and the aptly named Shutdown Timer. However, you don’t need any dedicated software for this purpose. All you need is this simple trick.
Read more: If you’re looking for a shutdown timer on Windows, there’s a quick tip for that, as well.
A built-in power schedule
Under Energy Saver settings, MacOS has a built-in wake and sleep schedule.
To enable it and create a schedule, go to System Preferences > Energy Saver and click Schedule… in the lower right corner of the window. There you can set a time and day (weekends or weekdays, too) that the Mac will start up or wake, as well as a time and day(s) when it will restart, shut down or sleep.
As useful as the schedule feature is, it’s limited in how it can work. Still, you could use it to shut down your computer at a specific time. Just select a time for the sleep or shutdown to happen after the process is expected to finish.
Make your own shutdown timer
If you want a shutdown timer that’s more adaptable, you only need to know a few terminal commands.
The shutdown command will, as expected, shut down your Mac when used in Terminal. But there are some important options that you will also want to use to make this shutdown timer meet your needs.
- -h will halt the system at a specified time.
- -r will reboot instead of shutdown.
- -s will put the Mac to sleep instead of shutdown.
There are other options, which you can read more about in Apple’s shutdown documentation, but for the purpose of a shutdown timer, -h, -r and -s are likely all you will need to know.This is a shutdown timer command for 15 minutes with a pid of 842.
If you remember this shutdown command, you can simply open Terminal and enter the command to create a shutdown timer. Some example shutdown timer commands would look like:
- A 15-minute shutdown timer: sudo shutdown -h +15
- A 30-minute restart timer: sudo shutdown -r +30
- A 1-hour sleep timer: sudo shutdown -s +60
When you enter one of these commands, you will need to enter the password for the user account and press return. The shutdown timer will then be created, giving you the exact time and date that the shutdown/restart/sleep process will occur. It will also give you the process ID, also known as a pid, which is a three- to a four-digit number.
If you wish to cancel a shutdown timer, take note of its pid and enter this command in Terminal: sudo kill [pid number].
Create a shutdown timer desktop shortcut
If you find yourself using the same shutdown timer often, you may want to create a desktop shortcut for the timer.
To do this, open TextEdit and click New Document. This opens a blank text document. If the document is not in plain text, press command + shift + T to switch to plain text.
On the very top line of the text file, type #!/bin/bash. This tells the operating system that the command should be executed using Bash.
Press return twice, and on the third line, enter your shutdown timer command, such as sudo shutdown -h +15. Save the file to Desktop and give it a simple name, like shutdown. Before clicking Save, make sure to uncheck the box beside If no extension is provided, use “.txt”. Click Save.
Finally, we need to make the file executable. Open terminal and change directory to Desktop by typing cd /Users/[username]/Desktop and press enter. Next, type chmod 774 shutdown and press enter.
Now if you double-click the shutdown shortcut on your desktop, Terminal will open, prompting you to enter your user password. Once entered, the timer will begin.
If you want to replace the default icon of an executable file, click to highlight the icon and press command + I. This opens the info page for the shortcut. Open the image you want to use in Preview and press command + A to select all and command + C to copy.
Lastly, in the info window for the shutdown timer, click the logo in the top left corner to highlight it, then press Command + V to paste the image.