How to run a MacBook headless with the lid closed

By Matyas Rathonyi. Updated November 23, 2026. Guides

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.

SSH, Screen Sharing and an agent keep reaching a MacBook with nothing attached while its lid closes. SSH Screen Agent no display
Headless means awake with nothing attached.Remote sessions and agents need the Mac running. Close the lid on a default MacBook and all of them stop at once.

"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

  1. 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.
  2. 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://arm on 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.
  3. 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:

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:

  1. Power. The power adapter is connected.
  2. An external display. Connected and active.
  3. An external keyboard. Wired or Bluetooth.
  4. 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.

Apple's clamshell mode: power, display, keyboard and mouse all attached, and the closed Mac keeps working. Power Display Keyboard Mouse Mac Apple: all four attached Headless with nothing attached: by default the closed Mac goes to sleep and work stops. Power? Display Keyboard Mouse Mac z Nothing attached: sleep
Apple's rule is all or nothing. With power, a display, a keyboard and a mouse attached, a closed MacBook keeps running. Take them away and closing the lid sleeps the Mac, which is exactly the headless case.

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.

ClamshellDummy display plugsudo pmset disablesleep 1
No external monitorYesFakes a monitorYes
Admin stepNoneNonesudo on and off
Works on batteryYes, 20% floorApple lists powerYes, no battery stop
Heat cut-offAlways onNoneNone
Manual undo neededNone on disarm/quitUnplug adapterStays on until undone
Price$9.99 once (7-day trial)$3.50 (Adafruit)Free
Mac and macOSApple Silicon, macOS 14+Any Mac with portAny 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.

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:

  1. 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.
  2. 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").
  3. 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.
  4. 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.

A phone or laptop reaches the closed Mac through Tailscale and connects over SSH or Screen Sharing. Every hop needs the Mac awake. You Tailscale Mac ssh screen every hop needs the Mac awake
Remote access finds the Mac, it does not wake it. Tailscale gives you a private path from anywhere, and Remote Login and Screen Sharing answer only while the Mac is running.

Headless MacBooks for agents, local models and builds

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):

A thermal gauge rises under sustained load. At serious or critical thermal pressure Clamshell disarms toward normal lid sleep. Thermal pressure serious: disarm
Thermal safety is always on. If macOS reports serious or critical thermal pressure, Clamshell disarms toward normal lid sleep and blocks arming until the Mac cools. pmset disablesleep has no such check.

When another setup is the better pick:

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.

Download free trial $9.99 once, no subscription

$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

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.