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
The official setup, dummy plugs, software options, and honest trade-offs.
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
Codex CLI, the desktop app, and Codex cloud tasks: which ones need the Mac awake.
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
Remote Control keeps dropping? Rule out Mac sleep with one command, then work through network, login and the 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 gets Codex past the lock screen, not past a closed lid. Setup, limits, the closed-lid options and the "Unable to update" error.
Keep a Cursor agent running with the lid closed
Cursor editor agents, the Cursor CLI, and Cloud Agents: why Cursor's wake lock is not enough.
Run AI coding agents overnight on a MacBook
What stops overnight runs, a pre-flight checklist, and how to check progress in the morning.
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
Why the Codex setting stops at a closed lid, and how to keep Codex running anyway.
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
Plex, Jellyfin, SSH and screen sharing on a closed MacBook, plus power and battery care.
Run a MacBook headless with the lid closed
What Apple's clamshell mode requires, why a closed MacBook sleeps without it, and dummy plug, pmset and app options with SSH and Screen Sharing.
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?
Heat and surfaces, thermal pressure, battery care on power, camera covers and a checklist for long runs.
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.
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
Step-by-step fixes for Closed-Display Mode, Power Protect and timed sessions.
KeepingYouAwake with the lid closed
Why it sleeps anyway when the lid closes, and which fixes work.
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
What each assertion flag does and why lid-close sleep is different.
What pmset disablesleep does on a Mac
How the undocumented switch behaves, how to inspect it, and how to undo it safely.
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 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.