Guides
How to hand work to AI agents, close your MacBook and walk away.
How to keep a MacBook awake with the lid closed
No external display, even on battery. The free way is sudo pmset -a disablesleep 1 (and 0 afterwards). Why the built-in options don't work, and how to do it safely without forgetting to undo it.
Keep your Mac awake while Claude Code runs
Hand off a long task and walk away without it stalling. The free commands that work right now (caffeinate, pmset), their limits, and how to check come first.
Approve Claude Code requests from your phone or a notification
Don't let “Can I run this?” stall the work. Answer without going back to the terminal.
Get notified when Claude Code finishes or needs you
Stop babysitting the terminal. The do-it-yourself hook, and how to get it on your phone too.
Check Claude Code's 5-hour and weekly limits
See it before a limit stops your work — the built-in way, and keeping it in the menu bar.
Run a local LLM overnight on a MacBook
Hand Ollama or LM Studio a long generation, embedding or fine-tuning job and close the lid without it stopping. The free options (caffeinate, pmset) and their limits come first.
Ways to keep a Mac awake, compared
Whether each one survives a closed lid, and whether it undoes itself when the work is done — in one table.
An Amphetamine alternative for AI agents
Amphetamine is a great free keep-awake app. Here's what long, open-ended runs like Claude Code or Codex need on top of that.
Keep your Mac awake while Codex CLI runs
Hand Codex a long task and walk away without it stalling. Codex's own setting and the free caffeinate and pmset options, with their limits, come first; letting the Mac sleep when it's done comes after.
What Codex's ‘Keep this Mac awake’ doesn't cover
The ‘Keep this Mac awake’ switch in the Codex app's Settings › Connections only prevents sleep while the Mac is plugged in and remote access is on. On battery, or with the lid closed and no external display, the Mac still sleeps and the task you started from your phone stops.
Why overnight Claude Code runs eat your limit
If the work was the same but your weekly limit dropped far more than expected, a Mac that slept mid-run may be the cause.
Fixing "Your computer went to sleep mid-response"
If Claude Code showed API Error: Your computer went to sleep mid-response. The response above may be incomplete., your Mac slept while the response was streaming. What the notice means, what to do now, and the free ways to stop it happening again.
Mac won't sleep after Claude Code
If the work is done but your Mac won't sleep, or the battery dropped overnight, first find out what's holding it awake.
Cleaning up leftover Claude Code processes
If you've ended your sessions but memory stays high or a port is still taken, a Claude Code CLI process (claude) or a dev server Claude started may still be running on your Mac. Start with one line, pgrep -x claude, to see how many are up.
Claude Code keeps retrying in DarkWake after lid close
If you closed the lid, woke up to a smaller limit and see "Connection lost while your computer was asleep" over and over, Claude Code was re-sending requests during the brief DarkWakes your Mac does while asleep.
Check Codex and Claude Code limits (5-hour and weekly)
Codex has /status, Claude Code has /usage. How to read both tools' 5-hour and weekly limits yourself, and how to keep them side by side in the menu bar so a sudden drop doesn't catch you out.
Codex automations stalling at Mac sleep or DarkWake
If a scheduled Codex automation or heartbeat didn't run overnight, or started and then stalled, your Mac's sleep and DarkWake (the few-second wakes it does while asleep) may be involved. Reports from public issues, what you can do for free and where it stops, and how to check yourself.
Keep track of many Claude Code sessions
Run Claude Code in four terminal tabs and the only way to find the one that's stuck waiting on you is to click through them. How to do it yourself (tab titles, notifications, tmux, claude agents), where that falls short, and how to see it all in one menu bar window.
Keep Remote Control sessions alive with the lid closed
If you use Claude Code's Remote Control to keep a session going from your phone and it stops the moment you close the MacBook lid: the session runs on the Mac, so it pauses when the Mac sleeps. The official docs only promise to reconnect "when your machine comes back online".
See what Claude Code did while you were away
Did the overnight task finish, where did it stop, is it waiting for your answer — in a minute, without opening every terminal.
When login expiry silently stops an overnight run
If you come back in the morning to Claude Code stuck on "Login expired · Please run /login" or "Authentication failed" for hours, your login ended overnight. The run stopped on an error and nothing told you.
Usage draining fast? Find which session used it
If your work hasn't changed but the 5-hour and weekly limits fill much faster, first check which sessions and subagents on your Mac used the tokens. A single agent stuck in a loop really can burn through a limit.
Codex hooks not running: review, trust and the hooks switch
Codex skips new or changed hooks until you trust them, and stays silent when hooks are switched off or blocked by policy; a hook can also run and be reported as failed. Here's how to find which one it is. Official docs: Codex Hooks.
Claude Code hooks not running: what to check
Added a hook and nothing happens? A disableAllHooks somewhere, or a managed policy, may be switching it off. Here's the order to find where.
Clamshell vs Lidnight
Both keep a MacBook awake with the lid closed. They differ in when they turn on and off, and what else they do.
Adrafinil vs Lidnight
Both keep a Mac awake only while AI coding agents work. The difference is a free open-source tool versus an app that also handles your phone and a recap.
Agent Caffeine vs Lidnight
Both keep a Mac awake with the lid closed while agents work, and let it sleep when they're done. The difference: a command-line and MCP tool, versus answering from your phone and a recap when you're back.
Hold My Lid vs Lidnight
Both keep a lid-closed Mac awake only while agents work, and let it sleep when they go idle. The difference: display and sound controls, versus answering from your phone and a recap.
Try Lidnight free
Apple Silicon Macs · macOS 13 or later. Every download includes a free trial of everything in Pro (5 lid-closed runs or 14 days), no payment details needed. Pro is a one-time payment (1 Mac $9.99 · 3 Macs $14.99, 50% off through Dec 1) with a 14-day refund.
Lidnight is a Mac app, so it can't be installed on this device. Open this address on your Mac to download it.
Copied. Paste it on your Mac to open it.
Couldn't copy. Tap the address below to select it, then copy.