Yes, you can run a MacBook headless, though not with the lid closed on stock macOS: closing the lid sleeps the Mac unless power, an external display, a keyboard, and a mouse are all attached. A dummy HDMI plug still leaves you under Apple's power and input rules with a dongle in a port, and sudo pmset disablesleep 1 asks for admin rights and can stay on after a restart until you undo it. Clamshell for Mac keeps a closed Apple Silicon MacBook awake and on the network with no display, no sudo, and nothing to undo, for $9.99 once after a 7-day free trial (no card required).
Written by Matyas Rathonyi, the maker of Clamshell for Mac.
"Headless" comes from servers: a machine with no screen, keyboard, or mouse that you control over the network. A Mac mini works that way because it has no lid. On a MacBook, closing the lid triggers sleep. Below: what Apple supports, why a closed MacBook sleeps, what each workaround asks of you, how to reach the Mac over SSH, Screen Sharing, and Tailscale, and how to handle heat and power. For an always-on media or file server, see using a MacBook as a home server with the lid closed.
Run a MacBook headless with Clamshell for Mac in three steps
- Install Clamshell and set up remote access. Download the 7-day free trial from clamshell.dev, or run
brew install --cask clamshell, and open Clamshell once. Turn on Remote Login or Screen Sharing (plus Tailscale for away access) as shown below, and test the connection with the lid open. - Arm it to stay armed. Right-click the menu bar icon, use the Arm Clamshell action in Shortcuts, or run
open "clamshell://arm"(clamshell-setapp://armon Setapp) so it stays armed across lid openings until you disarm. Arm for Next Close in the menu bar covers the next close only. Confirm the menu shows Armed. - Close the lid on a hard, open surface. The built-in display stays black while the Mac stays awake and reachable on the network, with no display and no sudo. With no monitor or dummy plug attached, opening the lid locks the Mac.
Clamshell runs on Apple Silicon Mac laptops with macOS 14 or later, notarized by Apple, via clamshell.dev, Homebrew, and Setapp. It is closed source and not on the Mac App Store (App Store apps named Clamshell come from other developers).
What headless means on a MacBook
On a MacBook, "headless" usually means one of two setups:
- Lid open, nothing attached. The Mac sits on a shelf with its screen off while you connect over SSH or Screen Sharing. Stock macOS handles this on power, though the open laptop stays exposed and takes up space.
- Lid closed, nothing attached. The Mac is folded shut and keeps running on the network. That is what most people want, and it is what stock macOS blocks by default.
Either way, the jobs are the same: Claude Code or Codex working through tasks, a local model server answering requests, a long build or test run, a download, or a small personal server.
What Apple's clamshell mode requires
Apple's support page for a dark external display (Apple Support 102501) lists what a closed Mac laptop needs: "make sure that the Mac is connected to power and using an external keyboard and mouse." That means four things attached at once:
- Power. The power adapter is connected.
- An external display. Connected and active.
- An external keyboard. Wired or Bluetooth.
- An external mouse or trackpad. Wired or Bluetooth.
That is a desk setup, not a headless MacBook. Unplug the display and close the lid, and macOS sleeps the laptop. See clamshell mode without an external display for more on that gap.
Why a closed MacBook sleeps
Closing the display is Apple's documented way to put a Mac laptop to sleep. In sleep, the Mac stops running programs: SSH freezes, Screen Sharing drops, agents and builds pause, and local model servers go offline.
Lid-close sleep is separate from idle sleep. Free idle tools such as caffeinate do not stop closing the lid from sleeping the Mac; see why caffeinate does not work with the lid closed.
Ways to run a MacBook headless
Here are the five common routes and exactly where the free or dongle options stop.
Lid open, display off, free
In System Settings > Lock Screen, set Turn display off on power adapter when inactive, and in Battery > Options, turn on Prevent automatic sleeping on power adapter when the display is off.
Where it falls short: it only works with the lid open and on power. Close the lid or unplug the Mac, and it sleeps.
Dummy display plug, a few dollars
An HDMI or USB-C dummy plug emulates a monitor. Adafruit's HDMI Dummy Plug (product 4247) costs $3.50, holds an I2C EDID EEPROM chip, and presents up to 3840 x 2160, which also gives Screen Sharing a resolution.
Where it falls short: it is extra hardware occupying a port, and Apple's support page still lists power plus an external keyboard and mouse for closed-display mode, so you must test it on your Mac before relying on it. See dummy display plug vs an app.
sudo pmset disablesleep 1, free
Running sudo pmset disablesleep 1 stops all sleep with nothing attached, lid closed and on battery too.
Where it falls short: it is a system-wide admin switch with no timer, no menu bar state, no heat cut-off, and no battery stop, and it can stay on after a restart until you undo it with sudo pmset -a disablesleep 0. Forget it and your closed Mac can stay awake in a bag. See what pmset disablesleep does and how to undo it.
Amphetamine, free
Amphetamine's Mac App Store listing describes keeping a MacBook awake with the lid closed.
Where it falls short: on Apple Silicon laptops, its listing states Power Protect "is only needed/available on Apple Silicon Mac laptops" and "is not included directly in Amphetamine and requires a separate download and installation" (adding a sudoers rule that needs an admin step). See Amphetamine not working with the lid closed. Its App Store listing shows version 5.3.2 from November 10, 2023.
Clamshell for Mac, $9.99 once
Clamshell keeps an Apple Silicon MacBook (macOS 14+) awake and online with the lid closed while armed, with no monitor, no dummy plug, no sudo, and no privileged helper. A dummy plug does not conflict with Clamshell, though you do not need one.
| Clamshell | Dummy display plug | sudo pmset disablesleep 1 | |
|---|---|---|---|
| No external monitor | Yes | Fakes a monitor | Yes |
| Admin step | None | None | sudo on and off |
| Works on battery | Yes, 20% floor | Apple lists power | Yes, no battery stop |
| Heat cut-off | Always on | None | None |
| Manual undo needed | None on disarm/quit | Unplug adapter | Stays on until undone |
| Price | $9.99 once (7-day trial) | $3.50 (Adafruit) | Free |
| Mac and macOS | Apple Silicon, macOS 14+ | Any Mac with port | Any macOS |
Verdict: Choose Clamshell if you want a closed, headless MacBook with no dongle, no admin rights, and built-in heat and battery cut-offs; choose a dummy plug, pmset, or Amphetamine if you need a free or $3.50 route or run an Intel Mac or macOS 13 and earlier.
What the free routes ask of you is leaving the lid open, carrying a dongle under Apple's power rules, installing Amphetamine's separate Power Protect add-on and sudoers rule so a session survives plugging in or unplugging on Apple Silicon, or remembering to undo a persistent sudo pmset flag. Why pay $9.99 once for Clamshell? You skip admin passwords, dongles, and manual cleanup while getting an always-on heat cut-off and a 20% battery floor out of the box.
- No monitor, no dongle, no admin rights. Notarized menu bar app for Apple Silicon (macOS 14+) with no sudo, no kernel extension, and no privileged helper.
- Built-in heat and battery protection. Thermal safety is always on and disarms at serious or critical thermal pressure; low-battery disarm at 20% is on by default.
- Nothing left to undo. Disarm, quit, or restart and normal lid sleep returns automatically.
- Ready for headless automation. Arm and disarm from the menu bar, Shortcuts, or
open "clamshell://arm"andopen "clamshell://disarm".
Try it on your headless setup before paying anything: Download free trial (free for 7 days, no card required; $9.99 once for 1 Mac or $19.99 for up to 3 Macs, with a 14-day money-back guarantee).
Reach the headless MacBook remotely
Once the MacBook stays awake lid-closed, set up remote access:
- SSH with Remote Login. In System Settings > General > Sharing, turn on Remote Login and set Allow access for to Only these users. Connect with
ssh username@hostname(shown below the Remote Login: On indicator). Apple warns that remote login can make a Mac less secure, so restrict access to your user. See SSH into a MacBook with the lid closed. - Desktop control with Screen Sharing. In Sharing settings, turn off Remote Management first (Apple notes both cannot run together), then turn on Screen Sharing and pick who may connect. It works with Screen Sharing and VNC viewers ("VNC viewers may control screen with password").
- Away from home with Tailscale. Install Tailscale on the Mac (macOS Monterey 12.0+) and your phone or second laptop under the same account. Its Personal plan is free ($0, up to 6 users), routing SSH and Screen Sharing over a private network.
- Test with the lid open first. Connect before closing the lid so you know any failure later is sleep, not network setup.
Apple's Wake for network access (Battery > Options) wakes a sleeping Mac for shared services; it does not keep coding agents, local models, or builds running.
Headless MacBooks for agents, local models and builds
- Coding agents. Run Claude Code or Codex inside
tmuxover SSH, close the lid, and check in from your phone. The tmux wiki notestmuxprotects remote programs from dropped connections, though it cannot survive Mac sleep; pair it with Clamshell. See keeping Claude Code running with the lid closed and running AI agents overnight. - Local models. Ollama, LM Studio, llama.cpp, and MLX servers stop answering when the Mac sleeps, and most bind to localhost until configured for LAN or Tailscale. See running a local LLM with the lid closed.
- Agents that need the screen. With Clamshell armed and its optional Agent Screen module enabled (off by default), computer use and the iOS Simulator keep working while the built-in display stays black. See can AI agents use the screen with the lid closed.
- Builds and downloads. Any compile, test run, or download that finishes open finishes closed while Clamshell is armed.
For scripted jobs, wrap runs with open "clamshell://arm" and open "clamshell://disarm", use Shortcuts, or enable Clamshell's optional Finish Work, Then Sleep module so the Mac sleeps after agents finish. Because open "clamshell://arm" is asynchronous, verify the menu bar shows Armed before shutting the lid.
Heat, power and safety
A closed headless MacBook sheds heat through its body and vents. Follow Apple's operating guidance (Apple Support 102336):
pmset disablesleep has no such check.- Temperature and surface. Keep ambient temperature between 10 and 35 C (50 to 95 F) on a hard, ventilated surface, never on a bed, pillow, or under bedding, and never inside a closed bag. See running a MacBook in a bag.
- Fans. On Macs with fans, Apple says they turn on automatically to cool components; keep airflow clear around the laptop either way.
- Power for long jobs. Clamshell works on battery with Disarm on low battery on at 20% by default, though long agent runs and local inference belong on power. See running lid-closed on battery.
- Leave the display off when nothing needs it. Keep Clamshell's Agent Screen module off (default) for SSH and CLI work so the display sleeps, saving power and heat.
When another setup is the better pick:
- You reboot remotely and need the Mac to stay awake closed without re-arming. Restarting always restores normal lid sleep in Clamshell for safety, so you arm again after a reboot.
- You run an Intel Mac, macOS 13 or earlier, or can leave the lid open on power. Stock macOS handles an open lid on power for free; Clamshell needs Apple Silicon and macOS 14 or later.
Frequently asked questions
Can you run a MacBook headless?
Yes, though not with the lid closed on stock macOS: closing the lid sleeps the Mac unless power, an external display, a keyboard, and a mouse are attached. To run headless lid-closed with nothing attached, arm Clamshell for Mac (no display, no sudo, 7-day free trial) instead of managing a dummy plug or sudo pmset disablesleep 1.
What does Apple's clamshell mode need?
Apple Support 102501 says a closed Mac laptop with a display connected needs power plus an external keyboard and mouse. Without them, closing the lid sleeps the Mac, which is why a closed headless MacBook needs a lid-closed app such as Clamshell.
Does a dummy HDMI plug make a MacBook headless?
A dummy plug emulates a monitor ($3.50 from Adafruit) and gives Screen Sharing a resolution, though it uses a port and Apple's page still names power plus a keyboard and mouse. For no dongle and built-in heat and battery cut-offs, try Clamshell free for 7 days instead.
How do I control a headless MacBook remotely?
Turn on Remote Login for SSH or Screen Sharing for the desktop in System Settings > General > Sharing, and install Tailscale (free Personal plan) for away access. Both need the Mac awake, so arm Clamshell before closing the lid.
Is it safe to run a MacBook headless with the lid closed?
Yes, within Apple's guidance: 10 to 35 C ambient, a hard ventilated surface, never on bedding or in a bag, and on power for long runs. Clamshell adds an always-on heat cut-off that disarms at serious or critical thermal pressure.
Why pay $9.99 for Clamshell when pmset, Amphetamine, or a dummy plug cost less?
sudo pmset disablesleep 1 needs admin rights, can stay on after a restart, and has no heat or battery stop; Amphetamine asks for a separate Power Protect installer and sudoers rule on Apple Silicon to survive plugging in or unplugging; and a dummy plug adds extra hardware under Apple's power rules. Clamshell costs $9.99 once (no subscription) so you skip admin passwords, dongles, and manual cleanup while getting an always-on heat cut-off and a 20% battery floor. Test the 7-day free trial (no card required) first.
Try Clamshell free for 7 days
Keep your Apple Silicon MacBook running headless with the lid closed and nothing attached, with no admin password, an always-on heat cut-off, and a 20% battery floor. Normal lid sleep returns when you disarm or quit.
$9.99 for 1 Mac, $19.99 for up to 3 Macs. 7-day free trial with no card required and a 14-day money-back guarantee. Apple Silicon, macOS 14 or later, notarized by Apple. Also available via Homebrew or Setapp.
Related guides
- MacBook clamshell mode without an external display
- Can you SSH into a MacBook with the lid closed?
- Use a MacBook as a home server with the lid closed
- Can Ollama keep running with the MacBook lid closed?
- Clamshell vs Amphetamine vs pmset for a closed MacBook lid
- Is it safe to run a MacBook with the lid closed?
Sources checked October 15, 2026: Apple Support 102501, 102336, and Apple macOS guides for sleep/wake, Remote Login, and Screen Sharing; Adafruit HDMI Dummy Plug (product 4247); Amphetamine's Mac App Store listing (version 5.3.2); Tailscale install and pricing pages; tmux wiki; and pmset(1). Clamshell details from version 2.0.5 and published documentation. Product names belong to their respective owners.