answers.delivery

How-to · 3 min read

How to close your MacBook while Claude Code is running

You start a long Claude Code or Codex task on your MacBook, then have to close the lid for a meeting, and the run stops when the Mac goes to sleep. You come back expecting a finished branch and find the agent frozen halfway through a file. So you start carrying the laptop half open between rooms, or you stay at your desk and wait. Neither is why you handed the work to an agent in the first place.

Published
19 Nov 2026
Delivery
No. 12
Topic
AI and agents
Evidence
10 claims quoted from nightcrewapp.com
Review
Approved by the founder

01
Why it's hard

macOS puts a laptop to sleep when the lid closes, and it has no idea an agent is in the middle of a job. The built-in caffeinate command can hold it awake, but you have to remember to start it for each run, and remember to stop it, or the Mac stays up long after the work is done. Simple keep-awake toggles usually only work with the lid open, and tools that watch for an app being open keep the Mac awake as long as the agent window exists, even when nothing is happening. On battery, holding a closed laptop awake with no limit is also how you end up with a warm bag and an empty battery.

This part describes the usual way. It makes no claims about Night Crew, so nothing is quoted here.

02
How Night Crew does it

Night Crew is a menu bar app that ties the keep-awake hold to the agent itself. It notices when Claude Code, Codex, Cursor or Gemini CLI starts working, keeps the Mac up while it works, and lets it sleep once the agent finishes and a short grace period passes. Closing the lid is handled by a small helper you approve once in System Settings, which can only switch sleep off and back on. By default lid mode only holds the Mac on the charger, and a battery floor and heat guard can stop it even while an agent is busy.

A normal app can’t stop lid sleep, so Night Crew uses a small helper you approve once in System Settings. It can do exactly two things: turn sleep off, and turn it back on.Quoted from nightcrewapp.com
Close the lid and go. On the charger, lid mode holds the Mac. On battery only if you allow it, with a 30% floor.Quoted from nightcrewapp.com
A 60-second grace, adjustable from 0 to 10 minutes. Builds it left running get up to 2 hours.Quoted from nightcrewapp.com

03
Step by step

  1. 1Download the app from nightcrewapp.com and open it; a moon icon appears in the menu bar.
  2. 2Let it detect your agents. Claude Code needs no setup, and the others get one small hook after their settings file is backed up.
  3. 3Turn on lid mode and approve the sleep helper once in System Settings.
  4. 4Choose charger only, or allow battery with its own floor.
  5. 5Start your agent task, plug in, close the lid and walk away.
  6. 6Check the journal later to see what kept the Mac awake and when it went back to sleep.

04
Tips

If you only ever close the lid at your desk with the charger in, try the free route first. A caffeinate flag can cover a closed lid on the charger, and the app's own compare page says so. The app is for when you want it to start and stop with the agent without you thinking about it.

Lid closed on the charger: caffeinate -s <your agent command>.Quoted from nightcrewapp.com

Keep the default of charger only unless you really need battery runs. When you do allow battery, the floor and the always-on heat guard will end the hold, so a long job may still stop if the battery gets low.

Allow battery and it stops at its own floor, 30% by default, or the moment your Mac gets warm: in lid mode the heat guard is always on.Quoted from nightcrewapp.com

Do not slip the closed Mac into a backpack while an agent runs. The heat guard stops the hold when the Mac gets hot, but a bag traps heat fast, so leave it on a desk or a shelf.

Never run it in a closed bag. Night Crew stops if your Mac gets hot, but a bag traps heat quickly.Quoted from nightcrewapp.com

If a run did stop overnight, open the journal before blaming the agent. It records each sleep and wake with a reason, such as heat, battery, lid, idle or an agent, so you can see which one cut the session short.

The journal keeps 14 days of every sleep and wake, each with its reason: heat, battery, lid, idle or an agent.Quoted from nightcrewapp.com

05
Questions

Does it work on an Intel Mac?

No. It needs macOS 14 or later on Apple silicon.

macOS 14+ · Apple silicon · signed and notarized by AppleQuoted from nightcrewapp.com

How much does it cost?

It is $9, paid once, for up to two Macs, after a 14-day free trial with no account or card.

Night Crew costs $9, paid once, for up to 2 Macs, with future updates and features included.Quoted from nightcrewapp.com

What if the app crashes while the lid is closed?

Normal sleep comes back by itself, so you do not have to reset anything by hand.

If Night Crew quits or crashes, normal sleep comes back on its own.Quoted from nightcrewapp.com

More on AI and agents

Night Crew has one answer so far, so these come from its topic