DEV Community

Dawon Lee
Dawon Lee

Posted on AI-assisted

Claude Code Remote Control stops when you close the lid. Here's why, and the fix

Claude Code's Remote Control is great: run claude remote-control (or /remote-control in a session), scan the QR code with the Claude app, and you can keep steering the session from your phone on the couch. Turn on Push when actions required in /config and permission prompts and questions arrive as pushes.

Then you close the MacBook lid, and the session goes quiet.

Why

The session runs on your Mac. Remote Control is a window into it, not a copy of it. When the Mac sleeps, Claude stops. The docs say exactly this:

if your laptop sleeps or your network drops, Claude Code reconnects automatically when your machine comes back online.

So it reconnects afterwards. Nothing runs while the Mac is asleep, and the message you sent from your phone waits until the lid opens again.

Closing the lid without an external display puts a MacBook to sleep regardless of caffeinate. Claude Code already runs caffeinate -i while it works, which only blocks idle sleep.

Fixing it yourself

Lid open, on power. Nothing to do. caffeinate -i keeps the Mac awake while a turn runs. If the light bothers you, pmset displaysleepnow turns the screen off without sleeping.

Lid closed (bag, bedside). The only thing that stops lid-close sleep is:

sudo pmset -a disablesleep 1
Enter fullscreen mode Exit fullscreen mode

Two things to know before you do that:

  • It survives restarts, and if you forget to run sudo pmset -a disablesleep 0 afterwards, the Mac stays awake in your bag, draining and heating. Keep it on a hard, ventilated surface.
  • On battery you get a few hours at most, and a Mac that's awake but idle will keep polling. If a turn is mid-stream when the Mac finally sleeps, you get the "went to sleep mid-response" retries.

Knowing when it's done. Besides Remote Control's own pushes, a Stop hook can ping you. I keep copy-paste versions of that (and of answering AskUserQuestion from a hook) in claude-code-hooks-recipes.

Doing it only while work runs

I build Lidnight, a menu bar app that takes just the part Remote Control leaves out: it uses Claude Code's and Codex's hooks to keep the Mac awake only while a turn is running (lid closed, on battery too), and once every session has been quiet for ten minutes it restores disablesleep and lets the Mac sleep. It also undoes a leftover disablesleep at boot, so a crash can't leave your Mac stuck awake.

Remote Control stays exactly as it is. Continue from your phone, leave the lid closed, and the Mac sleeps on its own when the work is done.

Top comments (0)