Use Your MacBook as a Music Player with the Lid Closed
Closing the lid stops the music: macOS has a separate lid-closed sleep path that "never sleep" and caffeinate can't block. Here's the no-password fix.
Why music stops when you close the lid
macOS has two sleep paths that are easy to confuse:
- Idle sleep: after a period of inactivity, the system enters a low-power state. The display can turn off while the system keeps running.
- Lid-closed sleep (clamshell sleep): triggered the moment you close the lid; it is a separate kernel path.
The built-in "never sleep" option only affects idle sleep. Ordinary power assertions (the same mechanism behind caffeinate) can't block lid-closed sleep either. So when you close the lid, the music stops, remote sessions drop, and downloads or builds stop.
The classic workaround is sudo pmset -a disablesleep 1: it needs an admin password, writes a persistent system setting, and is easy to forget — leaving the Mac running hot in a bag.
Three options compared
| Option | Keeps running with the lid closed? | Password needed? | Risk |
|---|---|---|---|
| Built-in "never sleep" | No | No | Only affects idle sleep |
pmset disablesleep 1 | Yes | Yes | Persistent change; easy to forget |
| Session-level lid-closed awake (HeyWakeup) | Yes | No | Restores automatically on quit / crash / restart |
HeyWakeup's Awake When Closed is session-level: it is active only while the app runs, and it restores the system default when the app quits, crashes, or the Mac restarts. Nothing persistent is left behind, and no admin password is required.
Set it up for music
There are three ways, depending on how hands-off you want to be:
- Manual: click the menu-bar icon and choose Awake When Closed. Good for a one-off listening session.
- Music scene: pick the Music scene in the panel or scenes list. It carries its own lid-closed mode and audio condition.
- Automatic: add an Audio playing condition under automatic keep-awake — Apple Music, Spotify, and browser playback such as YouTube all count. When the music stops, the condition clears and the app lets go.
If you only want this on AC power, add an AC only scope to the scene. It works on battery too; just enable low-battery protection as well.
Battery and heat
Lid-closed awake is not "keep the screen on": the built-in display turns off when the lid closes, and the system keeps running, so it uses less power than leaving the screen on. But the system is still awake, and the CPU and network keep working, so for long listening sessions, plug in.
HeyWakeup includes several guards by default:
- Stop on low battery: ends the session when the battery drops below a threshold (20% by default, adjustable) on battery power, and won't restart while the battery is low.
- Thermal protection: pauses and locks when the Mac runs hot, then resumes after it cools down.
- Automatic reset on quit / crash / restart: never leaves the Mac stuck in a no-sleep state.
Don't run a lid-closed Mac under a heavy load in a sealed bag for hours. Music is a light load, but in summer it is still worth watching the temperature.
FAQ
Does it work with Apple Music, Spotify and YouTube? Yes. The audio condition checks whether the system is outputting audio; browser playback counts.
What about Bluetooth headphones or AirPods? The output device doesn't matter. As long as the system is playing audio, the condition matches.
Can I use it on battery? Yes. Enable low-battery protection and set a session limit.
Does the built-in display stay on with the lid closed? No. Lid-closed awake only prevents system sleep; the built-in display still turns off.
Do I still need it with an external monitor? If you are connected to power and an external display, macOS's native clamshell mode may already be enough. See MacBook Clamshell Mode with an External Monitor: When Do You Need an App?.
Related reading
- Keep your Mac awake with the lid closed (no password)
- Keep AI Agent Runs Alive with the Lid Closed (Claude Code, Codex)
- MacBook Clamshell Mode with an External Monitor: When Do You Need an App?
Download HeyWakeup · Pricing · Support