Closing a MacBook lid triggers a different sleep path from ordinary idle sleep. These guides explain what macOS does, which workarounds actually affect the lid, and how to keep long-running work alive without pretending a monitor is attached. Clamshell, a Mac menu bar app, is one option: it keeps a MacBook awake with the lid closed, with no sudo and no external display.
Start here
How to keep a MacBook awake with the lid closed
Every method, with or without a monitor: Apple's setup, dummy plugs, caffeinate, pmset, Amphetamine, LidRun, and Clamshell.
Clamshell mode without an external display
Stock macOS sleeps a closed MacBook with no monitor. Compare a dummy plug, pmset and Clamshell.
Coding agents and long runs
Keep coding agents running with the lid closed
Claude Code, Codex, Cursor, terminal jobs, builds, downloads, and SSH sessions.
MacBook の蓋を閉じたまま Claude Code を動かし続ける方法
日本語版
Keep Codex running with the lid closed
Local Codex runs pause when the lid closes. Keep them going with no monitor and no sudo.
Use Codex from your phone with the lid closed
Codex in the ChatGPT phone app, SSH and tmux: what a closed MacBook lid breaks, and how to keep Codex reachable.
Keep your Mac awake only while Claude Code runs, with hooks
Claude Code hooks that keep the Mac awake while sessions are open and let it sleep after. Free with caffeinate, lid-closed with Clamshell.
Claude Code Remote Control keeps disconnecting? Check sleep first
Rule out Mac sleep with one command, then check process, network, login and known bugs.
Does Mac sleep burn your Claude Code usage limit?
Why agents re-send their whole context after each wake, what Anthropic's cache docs and changelog say, what users report, and how to stop paying for wake-ups.
Does Claude keep running if you lock your laptop?
Locking your Mac does not stop Claude Code; sleep and a closed lid do. The four states, and a two-minute test to prove it.
Claude Dispatch and Cowork: keep awake with the lid closed
Keep computer awake stops idle sleep, not the lid. What Dispatch and Cowork need from your Mac, and how to keep them going lid-closed.
If I close my laptop, will Claude keep running?
Closing the lid stops Claude Desktop's local work, while cloud tasks keep going. What Keep computer awake covers and how to keep local Claude work running.
Does Codex Goal mode keep running with the lid closed?
What goals, scheduled tasks and in-chat check-ins need from your Mac, and what Prevent sleep while running does not cover.
Codex Locked use: a locked Mac, not a closed lid
Locked use works on a locked, awake Mac. Closing the lid sleeps it. What to do instead.
Keep a Cursor agent running with the lid closed
Local Cursor agents pause at lid close. When Cloud Agents fit, and how to keep local runs going.
Run AI coding agents overnight on a MacBook
The six things that stop overnight runs, a pre-flight checklist, and a closed lid that stays awake.
Lid closed on battery
How each option behaves on battery, low-battery cutoffs, and heat.
Codex "Keep this Mac awake" not working with the lid closed
The Codex setting needs an open lid or a monitor. Here is how to keep Codex running closed.
Does Claude prevent sleep? Keep computer awake vs closed lid
What Claude Code's caffeinate and the desktop app's Keep computer awake cover, and what closing the lid still stops.
Claude Code cloud vs local on your Mac
When cloud sessions win, when your own Mac wins, and how to run both.
Claude Code Remote Control with the lid closed
What happens to your phone session when the MacBook sleeps, and every way to keep it working.
Computer use and iOS Simulator with the lid closed
Let agents use the screen with the lid shut: dummy plugs, virtual displays and Clamshell compared.
Does Xcode keep building with the lid closed?
What a closed lid does to Xcode, xcodebuild, swift build and cargo, what caffeinate -i covers, and how to keep a long build running.
Everyday uses with the lid closed
Play music with the MacBook lid closed
Spotify, Apple Music, AirPlay and speakers with the lid shut and no monitor.
Does a MacBook keep downloading with the lid closed?
What Power Nap covers, what it does not, and how to finish big downloads lid closed.
Use a MacBook as a home server with the lid closed
Keep Plex, Jellyfin and SSH online on a closed MacBook, with no monitor and no admin password.
Run a MacBook headless with the lid closed
Keep a closed MacBook awake and reachable over SSH and Screen Sharing, with no display or dongle.
Can you SSH into a MacBook with the lid closed?
Remote Login, why SSH drops at lid close, Tailscale from your phone, tmux for agents, and keeping a closed Mac reachable.
Can Ollama keep running with the MacBook lid closed?
What a closed lid does to Ollama, LM Studio, llama.cpp and MLX servers, serving a local model over LAN or Tailscale, and heat and battery during long inference.
Is it safe to run a MacBook with the lid closed?
Yes, on a hard surface. The real risks, and how a heat cut-off and battery floor cover them.
Is it safe to keep a MacBook running in a bag?
Heat, airflow and what thermal protection can and cannot do.
MacBook clamshell mode sleeps when unplugged? Does it need power?
What Apple says a closed MacBook with a monitor needs, what changes on Apple silicon, and the ways to keep working on battery.
Close a MacBook lid with a TV or projector connected
HDMI or AirPlay, on power or battery: what Apple's closed-lid setup needs, the free fixes, and how to keep the picture on with the lid shut.
How to wake a Mac on a schedule and run jobs at night
Why cron skips jobs while the Mac sleeps, a scheduled wake with pmset, a launchd job that holds idle sleep, and what a closed lid changes.
How to use a MacBook in clamshell mode with an external monitor
Apple's closed-lid setup step by step, display limits by model, and how to run it on battery with Clamshell.
MacBook clamshell mode not working? Why the monitor goes black when you close the lid
Apple's checklist for a monitor that goes black when you close the lid, and the fix for battery use.
Can I close my MacBook while it's updating?
Not while macOS installs, Apple says. How to update overnight, and what to use for other long downloads.
Apps compared
Every comparison in one table
22 Mac keep-awake apps, commands and plugs: whether each works lid closed with no display, how, price and verdict.
Dummy display plug vs an app
HDMI dummy plug or an app? What the plug needs (power, a port), what it costs, and when software is the better way to keep a closed MacBook awake.
Clamshell vs Insomnia
Insomnia is free and open source but needs an install password, a sudoers rule and macOS 26; Clamshell is notarized with no admin step. Compared from Insomnia's own repository.
Clamshell vs Capsomnia
Capsomnia turns Caps Lock into a keep-awake switch through a privileged helper and pmset; Clamshell needs no admin rights. Compared from Capsomnia's own repository.
Clamshell vs Macchiato
Macchiato is free and open source but uses a root helper and system-wide pmset; Clamshell is paid with no admin step. Compared from Macchiato's own repository.
Clamshell vs Amphetamine vs pmset
An honest comparison of setup, scope, recovery, price, and the built-in Apple route.
LidRun vs Amphetamine vs Clamshell
A fair three-way comparison of price, setup, safeguards, and agent features.
Clamshell vs LidRun
LidRun or Clamshell for coding agents with the lid shut? A root helper and pmset with agent detection, or an app with no admin step.
Clamshell vs Caffeinated
Caffeinated's listing says it stops at the lid, yet 3.2.0 adds a lid option. Compare its $3.99 idle app with a lid-closed app that needs no admin step.
Hold My Lid vs Clamshell
Two paid lid-closed apps for coding agents: agent detection versus a no-admin switch.
Adrafinil vs Clamshell
Free and open source with a root helper, or paid with no admin rights and older macOS support.
Amphetamine alternatives for closed-lid use
Where Amphetamine is strong, and the alternatives on Apple Silicon.
What is Clamshell for Mac?
What the app does, what it is not, how it works, and what it costs.
Best apps to keep a MacBook awake, lid closed or open
20 keep-awake apps and commands, lid open or closed, checked in October 2026.
Keepresso vs Clamshell
Free, open source and agent-aware with an admin helper, or a no-admin paid switch.
Sleepless vs Clamshell
A free MIT app that runs pmset through a sudoers rule on macOS 26, or no sudo at all on macOS 14 and later.
Helmlet vs Clamshell
Fan control and a privileged helper, or no admin rights and a 7-day trial.
Amphetamine not working with the lid closed
Four fixes for Closed-Display Mode, what Power Protect asks of you, and a no-admin alternative.
KeepingYouAwake with the lid closed
Why it sleeps anyway when the lid closes, and which fixes work.
Is there a free app to keep a MacBook awake, lid closed?
Yes, but almost every free one asks for a helper, sudo rule or manual undo. Clamshell asks for none.
LidAwake for Mac: which one, and how Clamshell compares
Several Mac apps share the name, and each asks for a helper or sudo rule. Which is which, and how Clamshell works with no admin rights.
Sleepless vs Amphetamine vs Clamshell
Sleepless needs macOS 26 and a sudoers rule; Amphetamine needs its Power Protect add-on to survive a charger change. Clamshell needs no admin step.
Amphetamine vs KeepingYouAwake vs Caffeine
All three are free with the lid open. Close the lid and only Clamshell needs no admin step.
Is the Amphetamine Mac app safe?
What Apple, its privacy label and the Power Protect installer show, and a closed-lid option with no sudoers file.
How macOS sleep works
caffeinate and pmset command builder
Pick a goal and copy the exact Terminal command, with what it does, its limits and how to undo it.
How keep-awake apps work with the lid closed
Assertions, pmset disablesleep, closed-display mode and apps with no admin step: admin rights, crash cleanup and which apps use which.
Why caffeinate does not keep a Mac awake with the lid closed
caffeinate blocks idle sleep only, so a closed MacBook sleeps anyway. What keeps it running instead.
What pmset disablesleep does on a Mac
What the command changes, how to check and undo it, and a closed-lid option with nothing to undo.
How to undo sudo pmset disablesleep 1
Check SleepDisabled, turn it off with one command, and confirm it stuck.
Mac won't sleep, or Sleep is greyed out? Find what keeps it awake
Check SleepDisabled, the processes pmset lists as preventing sleep, sharing, remote sessions and network wake, in that order.
MacBook close lid settings: is there a do nothing option?
No do nothing lid setting on Mac. What System Settings and Terminal change, and how Clamshell fills the gap.
Which app keeps a Mac awake for AI agents, lid closed?
Close the laptop and the agent stops. Free apps ask for admin rights; Clamshell does not.
Will OpenClaw keep running if you close your MacBook?
No, the Gateway stops while the Mac sleeps. Keep the closed MacBook hosting OpenClaw with Clamshell.
Will Copilot in VS Code keep running if you close your laptop?
A local Copilot turn stalls when the Mac sleeps. Keep it running with the lid closed using Clamshell.
MacBook or Mac mini for AI agents running 24/7?
Skip the $899 Mac mini: run agents 24/7 on the MacBook you own with Clamshell for $9.99.
Keep a work MacBook awake, lid closed, without admin rights
No admin rights? sudo pmset and most lid apps fail. Clamshell keeps the closed MacBook awake without sudo.
MacBook battery drains overnight while asleep? Check for DarkWake
Read the sleep and wake log, count DarkWakes, and turn off the wake sources Apple documents for battery.
How to prevent your Mac from sleeping
Free System Settings and caffeinate steps for an open lid, and what keeps a closed MacBook running.
What does caffeinate do on a Mac?
Every caffeinate flag, ready-to-run commands, how to stop it, and where it stops at a closed lid.
pmset -g explained, line by line
Read every pmset -g line, see what holds sleep off, and skip the sudo disablesleep cleanup.