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:

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

OptionKeeps running with the lid closed?Password needed?Risk
Built-in "never sleep"NoNoOnly affects idle sleep
pmset disablesleep 1YesYesPersistent change; easy to forget
Session-level lid-closed awake (HeyWakeup)YesNoRestores 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:

  1. Manual: click the menu-bar icon and choose Awake When Closed. Good for a one-off listening session.
  2. Music scene: pick the Music scene in the panel or scenes list. It carries its own lid-closed mode and audio condition.
  3. 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:

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

Download HeyWakeup · Pricing · Support

2026-12-01