Keep your Macbook wide awake. For agentic workflows, on the go.
dexy is a one-word toggle for macOS's built-in "never sleep — even with the lid shut" mode.
Flip it on before you close the laptop, to keep your agents running, a download progressing, or whatever else that helps you remain productive always. Just add an internet connection via your hotspot, and you can keep your Macbook in action all day.
Functionally, this is just a cute little wrapper around pmset's SleepDisabled flag. But it's easier to type four characters than to remember the full pmset command every time.
$ dexy
● dexy: ON — wide awake (battery sleep 0, lid-closed sleep disabled)
$ dexy status
● dexy: ON — wide awake (battery sleep 0, lid-closed sleep disabled)
$ dexy off
○ dexy: OFF — normal sleep (battery sleep 5m, lid-closed enabled)brew install jonobri/tap/dexygit clone https://github.com/jonobri/dexy
ln -s "$PWD/dexy/dexy" /usr/local/bin/dexy # or anywhere on your PATHdexy toggle on/off
dexy on stay awake — disable sleep, even with the lid shut
dexy off restore normal sleep
dexy status show the current state
dexy setup-sudo allow passwordless toggling (one-time setup)
dexy remove-sudo undo setup-sudo
dexy -h help
dexy -v version
Toggling sleep is a privileged operation, so on/off/toggle run pmset
under sudo and may ask for your password. status never needs sudo.
If you toggle often and don't want to type your password each time, run:
dexy setup-sudoThis installs a small sudoers
drop-in at /etc/sudoers.d/dexy that lets dexy run only the exact pmset
commands it needs — battery idle-sleep and the lid-closed sleep toggle —
without a password. It validates the rule with visudo before installing it
(a malformed sudoers file can lock you out of sudo), and asks for your
password just that once, to write the file. The rule grants nothing beyond
those pmset calls — no general pmset access, no other binaries:
<you> ALL=(root) NOPASSWD: /usr/bin/pmset -b sleep [0-9]*, \
/usr/bin/pmset -b disablesleep 0, \
/usr/bin/pmset -b disablesleep 1
Undo it any time with dexy remove-sudo (or sudo rm /etc/sudoers.d/dexy).
It's entirely optional — without it, dexy just falls back to prompting.
- Restoring sleep.
dexy onremembers your battery idle-sleep timeout anddexy offputs that exact value back, so it never clobbers your setting (or leaves system sleep lower than display sleep, which makespmsetcomplain). To force a specific value instead, set:The remembered value is the only thing dexy persists (inexport DEXY_SLEEP_MINUTES=10~/.local/state/dexy/); on/off is always read back from the system flag. - Scripting.
dexy statusprints a stabledexy: ON/dexy: OFFline you can grep. SetNO_COLOR=1to strip ANSI colours.
macOS gates lid-closed sleep behind the SleepDisabled power-management flag.
dexy on runs:
sudo pmset -b sleep 0 # don't idle-sleep on battery
sudo pmset -b disablesleep 1 # and don't sleep when the lid closesdexy off reverses both. That's the whole trick—no daemon, no menu-bar app,
nothing running in the background. When dexy is on, it's on because the system
flag is set, and dexy status reads that same flag back, so the two can never
drift out of sync.
Heads up: while dexy is on, your Mac will not sleep on battery with the lid shut. Great for a long unattended job; less great if you toss it in a bag and forget.
dexy off(or a reboot) clears it.
A little something to keep your Mac up past its bedtime. Use responsibly. ☕
MIT © Jonathan O'Brien