brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: pmset repeat wakes or starts your Mac on a schedule

Terminal
~/tips/tip-macos-pmset-repeat-schedule

sudo pmset repeat wakeorpoweron MTWRF 07:45:00 sleep MTWRFSU 23:30:00

Schedules your Mac to wake, start, sleep or shut down at fixed times.

A Mac that is awake and ready when you sit down is a small luxury. pmset can schedule that, together with a sleep or shutdown at night, without any third-party app.

pmset repeat sets daily or weekly events. The types are sleep, wake, poweron, shutdown and wakeorpoweron, the days are letters from MTWRFSU (R is Thursday, U is Sunday) and the time is 24-hour. Changing it needs root:

sudo pmset repeat wakeorpoweron MTWRF 07:45:00 sleep MTWRFSU 23:30:00

That wakes or starts the Mac at 07:45 on weekdays and puts it to sleep at 23:30 every night. To see what is planned, and to clear it again:

pmset -g sched
sudo pmset repeat cancel

For a one-time event there is pmset schedule. Watch the date format, which is American: "MM/dd/yy HH:mm:ss" in quotes. Here in the Netherlands I’d write 5 March as 05/03, and pmset would read that as 3 May. So 5 March at 06:00 becomes:

sudo pmset schedule wake "03/05/27 06:00:00"

The caveat is in the man page: you can only have one pair of repeating events, one power on event and one power off event. Setting a new repeat replaces the old one, and repeat cancel removes all of it at once. I’d always check pmset -g sched after a change, because a wrong letter in the day string fails quietly into a schedule you did not mean.

Further reading: pmset man page (ss64), pmset.1 source (Apple open source)

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link