It’s late, you’ve got something playing, and you already know you’ll be asleep before it
finishes. Your Mac won’t be. It’ll sit there lighting up an empty room, waiting for a lid
that isn’t going to close itself.
There used to be a setting for exactly this. Apple deleted it.

Your Mac used to have a sleep timer built in
For years, System Settings kept a Schedule button tucked inside Energy Saver. Tick a box,
pick a time, done: your Mac put itself to sleep at eleven every night, whether you were
still awake or not. It was never anybody’s favourite feature, which is probably why almost
nobody made a fuss when macOS 13 Ventura
quietly removed it.
Most of us found out the same way. You go looking for the sleep timer, in the place it has
always been, and it simply isn’t there any more.
Apple didn’t quite finish clearing up after itself, though. The Battery pane on my Mac
still ships every label that old sheet needed.
$ plutil -extract en json -o - \
/System/Library/ExtensionKit/Extensions/PowerPreferences.appex/Contents/Resources/BatteryUI.loctable \
| python3 -m json.tool | grep '"SCHEDULE_'
"SCHEDULE_TITLE": "Schedule",
"SCHEDULE_SLEEP": "Sleep",
"SCHEDULE_EVERYDAY": "Every Day",
"SCHEDULE_WEEKDAYS": "Weekdays",
"SCHEDULE_AT_TEXT": "at",
"SCHEDULE_OK_TEXT": "Apply",
Nineteen strings, days of the week included, translated into forty languages, still
shipping in macOS 26.5. Every word you’d need to build a sleep timer is sitting there on
disk. The sleep timer itself is gone.
The Terminal fix everyone recommends
Ask about this online and somebody will point you at pmset, which genuinely can do the
job:
sudo pmset repeat sleep MTWRFSU 23:00:00
That works. It’s also not a real replacement, for three reasons you only discover once you
try living with it.
It wants your password. Every single time.
”pmset must be run as root in order to modify any settings.” That’s the man page’s own
sentence, not my editorialising. Putting your laptop to bed should cost you a click, not a
sudo prompt.
You get one repeating schedule. Total.
The man page again: you may only have “one pair of repeating events” scheduled, one power
on and one power off. So a nightly sleep and a nightly shutdown can’t both exist on the
same machine, and that’s a system-wide limit with no way around it.
It can’t do “forty more minutes”
This is the real gap, and it’s the one that bothered me. Most nights I don’t want a
schedule at all. I want a countdown, because I’ve just put something on and I can guess
roughly when I’ll be out. pmset repeat is a calendar. What I wanted was a kitchen timer.
So I built one
Sleep Timer is a small menu bar app that does the thing the checkbox used to, plus the
countdown macOS never offered. It lives in the menu bar, has no Dock icon and no window,
and comes in two flavours.
Timer mode: sleep in forty minutes
Type a number, pick seconds, minutes or hours, hit Start. Forty minutes is 40, Min,
Start. From then on the remaining time sits up in your menu bar next to a small moon, so
the one thing you care about is readable without clicking anything.
Clock mode: sleep at eleven
Pick a time of day and it resolves to the next occurrence of it. Set 23:00 at nine in the
evening and you’ve got two hours; set 23:00 at half past eleven, when tonight’s has
already been and gone, and it rolls forward to tomorrow. The popover spells its answer out
as Next 11:00 PM, because “the next matching time” is precisely the sort of phrase where
you and the software can quietly disagree.
That’s the whole app. There’s no account to make and no preferences pane to get lost in.
How it got built
I described the app I wanted, and Claude came back with a plan rather than code. I read
through the plan, changed the parts that didn’t fit what I had in mind, and once it
matched, Claude built it.
The order turned out to matter. Revising a plan is fast, because the only things on the
page are decisions. Revising a finished app means reading Swift and working out which
lines are choices and which are just how it happened to get written. Both routes get you a
working menu bar app. Only one of them lets you argue with the design before it exists.
Under the hood, if you’re the curious type
The whole thing rests on one command
process.executableURL = URL(fileURLWithPath: "/usr/bin/pmset")
process.arguments = ["sleepnow"]
That root requirement from earlier applies to modifying settings. sleepnow isn’t a
setting, it’s an immediate action, and you’re perfectly entitled to put your own Mac to
sleep. That one detail is why this is 506 lines of Swift across three files, rather than a
privileged helper tool with an alarming authorisation prompt the first time you launch it.
Store the deadline, not the countdown
The obvious way to build a countdown is a number you subtract one from every second. Sleep
Timer doesn’t do that. It stores the target Date and recalculates on every tick:
let secondsLeft = max(Int(targetDate.timeIntervalSinceNow.rounded(.down)), 0)
I went in assuming I’d justify this with timer drift, so I measured it: twenty ticks over
a deliberately congested run loop came out four milliseconds long. Drift wasn’t the reason
at all.
The actual reason is that timers stop when your Mac does. Close the lid on a decrementing
counter and it resumes right where it paused, so a timer with eleven minutes left before
lunch still has eleven minutes left after, and the deadline you asked for has silently
slid by an hour. Ask the wall clock instead and the answer is correct the instant your
screen comes back. For an app whose whole job is the border between awake and asleep,
that’s worth six extra lines.
One honest catch before you download it
The app isn’t signed with an Apple Developer ID yet, because that’s a $99 a year
membership and this is a weekend tool. So macOS will quarantine the download and tell you
the app is damaged. It isn’t. That’s Gatekeeper being suspicious of anything unsigned, and
one command clears it:
xattr -dr com.apple.quarantine "/Applications/Sleep Timer.app"
If you’d rather not run that, clone the repo and build it yourself instead. It’s swift build and a single packaging script, with no dependencies to install first. The signing
and notarisation steps are already written up in RELEASE.md for the day I get round to
paying Apple.
While we’re being honest about limitations: there’s no repeating schedule yet, no warning
before it fires, no launch at login, and nothing survives quitting the app. None of that
has irritated me enough to fix, which is a decent test for a tool this size.
Give your Mac a bedtime
Apple took the sleep timer out. There’s no particular reason you have to live without one.
The download is 840 KB, it’s free, and it has no dependencies.
Download Sleep Timer from GitHub -
macOS 13 or later, Apple silicon. The source is all there too, so if you want it to behave
differently, fork it and change it. It’s small enough to read in one sitting, which is the
main reason I’d rather hand you the source than just the binary.
Sources: