Keep your Mac or Linux machine awake for a set number of hours — then let it sleep.
slpless is a tiny command-line tool. You give it a time (like 8 for 8 hours) and it stops your computer from going to sleep for that long. When the time is up, everything goes back to normal automatically.
It's lightweight (zero dependencies), cross-platform (macOS + Linux), and self-healing: if the thing keeping your machine awake ever gets killed, slpless notices and brings it right back.
$ slpless 8
☕ slpless — keeping this machine awake for 8h 0s
it will sleep normally again at 11:24 PM · press Ctrl-C to stop early
⏳ 7h 59m 58s remainingWith Node.js 14+ installed:
npm install -g slplessNot published to npm yet? You can install straight from GitHub:
npm install -g DevStrategist/slpless
That's it — the slpless command is now available everywhere.
slpless 8 # stay awake for 8 hours (live countdown in your terminal)
slpless 30m # 30 minutes
slpless 90s # 90 seconds
slpless 0.5h # half an hourA bare number means hours. You can also write h, m, or s.
Add -d and slpless keeps going even after you close the terminal:
slpless 8 -d # 8 hours, in the background
slpless status # how much time is left?
slpless stop # end it early$ slpless status
☕ slpless is awake.
pid: 48213
remaining: 6h 12m 04s
wakes at: 11:24 PM| Command | What it does |
|---|---|
slpless <time> |
Keep awake for <time> with a live countdown |
slpless <time> -d |
Same, but in the background |
slpless status |
Show the current background session |
slpless stop |
End the background session early |
slpless --help |
Show help |
slpless --version |
Show the version |
slpless doesn't reinvent anything — it drives the tool your OS already ships with:
- macOS →
caffeinate - Linux →
systemd-inhibit
On top of that it adds a small supervisor. It watches the sleep-blocker, and if that process ever exits early — crashed, OOM-killed, killed by accident — it respawns it and keeps going until your time is up. Every sleep-blocker it starts is also given a hard time limit, so even in the worst case (say slpless itself is force-killed with kill -9), your machine falls back to sleeping normally instead of staying awake forever.
No background daemons are installed, nothing runs at boot, and there are zero npm dependencies.
- Laptop lids. On Linux,
slplessalso blocks the lid switch. On a Mac laptop, closing the lid may still sleep the machine unless an external display is attached — that's a macOS hardware behaviorcaffeinatecan't override. - Requires systemd on Linux.
systemd-inhibitships with systemd, which nearly all modern Linux desktops use. - It's per-session. Closing a foreground run (Ctrl-C or closing the terminal) ends it. Use
-dif you want it to outlive the terminal.
git clone https://github.com/DevStrategist/slpless.git
cd slpless
npm test # runs the duration-parser tests
node bin/slpless.js 10s # try it for 10 seconds