Automate Wake, Power On, Shut Down, and Sleep Events on macOS
Managing power schedules on macOS can be incredibly helpful for automating wake, power on, shutdown, and sleep events. Apple’s macOS provides a built-in utility to schedule these actions, offering users a streamlined way to control when their Mac wakes, sleeps, or shuts down. This functionality is especially useful for users who want to conserve energy or automate workflows on their machines. Let’s walk through the various options available and some sample Terminal commands for each.
Power Schedule Options on macOS
You can schedule four main events on a Mac:
Wake: Turns the Mac on from sleep or a powered-off state.
Power On: Boots the Mac from a powered-off state.
Shut Down: Powers the Mac down at a scheduled time.
Sleep: Puts the Mac into sleep mode.
These can be configured directly through System Preferences or using the Terminal, which provides additional flexibility for advanced users.
Using System Preferences for Basic Scheduling
For a straightforward approach, go to:
System Preferences > Battery (or Energy Saver on older macOS versions).
Click Schedule.
Choose Start up or wake, Sleep, or Shut Down and set the desired schedule.
While this method is convenient, it has limited options. For more specific configurations, the Terminal is ideal.
Scheduling Events with Terminal Commands
macOS provides the pmset
command in Terminal to schedule and manage these events. Here are some commonly used commands:
Wake or Power On the Mac at a Specific Time
sudo pmset repeat wakeorpoweron MTWRFSU 08:00:00
MTWRFSU represents the days of the week (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday).
08:00:00
specifies the time (in 24-hour format) to wake or power on the Mac each day.
Schedule a Shutdown Event
sudo pmset repeat shutdown MTWRFSU 22:00:00
This will shut down the Mac at 10:00 PM every day. You can adjust the days and time as needed.
Put the Mac to Sleep at a Certain Time
sudo pmset repeat sleep MTWRFSU 23:00:00
This command puts the Mac to sleep at 11:00 PM each day.
Custom One-Time Events with
schedule
Command In addition to therepeat
option, you can useschedule
to set a one-time event:sudo pmset schedule wakeorpoweron "09/12/2023 07:30:00"
Replace the date and time as needed. This command wakes or powers on the Mac only at the specified date and time.
Checking and Clearing Scheduled Events
To View Existing Schedules:
pmset -g sched
This lists all scheduled power events, including wake, power on, sleep, and shutdown.
To Clear Scheduled Events: If you want to cancel all scheduled events, use:
sudo pmset repeat cancel
Additional Tips
Wake-On-LAN: You can also enable your Mac to wake on network access, which is useful if you need to access it remotely. Use:
sudo pmset -a womp 1
This allows network devices to wake the Mac over a network connection.
Preventing Sleep: If you want to temporarily prevent your Mac from going to sleep (e.g., for a presentation), use:
caffeinate
This command keeps the Mac awake while it runs, and you can cancel it with
Control + C
.
By leveraging macOS’s scheduling capabilities, you can automate your Mac’s power management to suit your routine, conserve energy, or maintain control over when your device is accessible. Whether using System Preferences or Terminal commands, these options offer flexibility to meet your power management needs.