CYSTEMS

The INSOMNIA guide · 28 Oct 2026

One line keeps your Mac awake with the lid shut

You commented INSOMNIA. Here's the line I use, what the Insomnia app adds on top of it, and how I run it.

1The line

My agents have run with the lid shut for over a year and a half. This is the line.

Paste into Terminal
sudo pmset -a disablesleep 1

sudo asks for your password. Your Mac stops sleeping, lid open or shut.

This is the line that turns it back off:

Paste into Terminal
sudo pmset -a disablesleep 0

The line has no timer, no battery limit and no heat limit. That part is on you.

2What Insomnia adds

Insomnia is an open-source menu bar app (MIT) by Krish Garg. Under the hood it runs the same line. Around it:

It needs macOS 26 or later on an Apple Silicon Mac. Its own README calls it experimental.

To install, the README gives you one prompt to paste into your coding agent. The installer adds a sudoers rule. It lets your user, and any program running as you, run four pmset commands without a password. Read that part of the README before you install.

3How I run it

I close the lid, the laptop goes in my bag, and it rides my iPhone hotspot. The agents keep working while I walk.

4The links