Music

How to play music on a MacBook with the lid closed

Close a MacBook and it sleeps, so the music stops. Keep Mac Awake keeps it awake with the lid closed and no display, for speakers, AirPlay or Bluetooth.

Short answer: The music stops when you close a MacBook because closing the lid puts the Mac to sleep, and no music app can hold that off: Apple's note on sleep says "it is not possible to prevent forced sleep, only delay it". Apple's own way around the lid, closed-display mode, needs power, an external display, a keyboard and a mouse. To keep music playing with the lid closed and nothing else connected, the first choice is Keep Mac Awake: start a session from the menu bar or with keepmacawake start --hours 3, close the lid, and Spotify, Apple Music or any other app keeps playing to the output you picked, such as an AirPlay speaker or Bluetooth headphones.

Download for MacFree for 3 days, no card. Then $9 once.

Why does music stop when I close my MacBook?

Because the Mac goes to sleep. Apple lists "On a Mac laptop, close the display" as one of the ways to put a Mac to sleep (Apple Support). A sleeping Mac runs no apps, so Spotify, Apple Music, YouTube in a browser or a podcast app all fall silent, whatever speaker or headphones they were playing to.

With the lid open, a music app can keep a Mac awake. Apple: "Apps that access a disk can keep your Mac from going to sleep. For example, Music accesses your disk to read the songs it plays" (Apple Support). That covers sleep after inactivity, not the lid. Apple's note QA1340 says "Closing the lid on a laptop or selecting sleep from the Apple menu both cause forced sleep", and that "it is not possible to prevent forced sleep, only delay it" (QA1340). Run pmset -g assertions to see what your player holds; whatever it shows, the lid still wins.

Can a MacBook play music with the lid closed?

Yes, while it stays awake, and in Apple's kernel source a closed MacBook stays awake in only two cases: Apple's closed-display mode (IOPMrootDomain.cpp), or the system-wide SleepDisabled setting, which blocks sleep for every reason (IOPMrootDomain.cpp).

  • Closed-display mode (clamshell mode) needs a display and power: "If the display is connected to a Mac laptop computer with a closed lid, make sure that the Mac is connected to power and using an external keyboard and mouse" (Apple Support). It ties the Mac to a desk with a display on it.
  • SleepDisabled works with nothing connected. Keep Mac Awake turns it on for one session you start and turns it off afterwards; sudo pmset disablesleep 1 turns it on by hand, with no end.

Every way to close a MacBook without it sleeping is compared in how to close a MacBook without it sleeping.

How do I keep music playing with the lid closed?

Start a Keep Mac Awake session before you close the lid. It keeps a MacBook with Apple silicon on macOS 26 or later awake with the lid closed and no display, keyboard or mouse:

  1. Plug the Mac in, or allow battery use (next section).
  2. Pick the output in System Settings > Sound > Output: the Mac's speakers, headphones, a Bluetooth speaker or an AirPlay speaker (Apple Support).
  3. Start the music, then start a session from the Keep Mac Awake menu bar app, or in Terminal:
keepmacawake start --hours 3   # awake with the lid closed for 3 hours
keepmacawake status            # check the session
keepmacawake stop              # normal sleep again
  1. Close the lid and listen for a minute before you walk away.

A timed session ends on time and normal sleep returns, so a playlist left running all night stops when the session does. The built-in display goes dark with the lid closed. A session never starts by itself; after a restart, start a new one.

Does it work on battery, and does it get hot?

On AC power by default; battery is your choice. If you unplug during a default session, the session waits until power is back, and in the meantime the closed Mac can fall asleep. To play on battery, allow it for the next session, down to a floor you pick: keepmacawake config set --battery allowed --min-battery 30. On battery a session also ends at a serious thermal state; on AC power, heat is left to macOS. More in keep a MacBook awake with the lid closed on battery.

Careful: A closed MacBook that plays music still makes heat. Apple says to use a Mac laptop "on a stable work surface that allows for good ventilation" and not "in your bed, on a pillow, or under bedding" (Apple Support). Never close an awake Mac into a bag or a backpack to carry the music with you. See is clamshell mode bad for a MacBook: heat and battery.

Does AirPlay keep working with the lid closed?

Yes, while the Mac stays awake and on the network. Apple: "Make sure that your Mac and speakers are on the same network", then choose the speaker with AirPlay in the Music app's playback controls, or with AirPlay under Sound in Control Center for other apps (Apple Support). One limit from the same page: "You can't use AirPlay to stream audio to multiple speakers from Control Center on a Mac." Keep Mac Awake keeps the Mac awake, not the network: it does not keep Wi-Fi alive or reconnect it, so put the Mac where the Wi-Fi is good.

What about Bluetooth speakers and headphones?

Connect them with the lid open, in System Settings > Bluetooth, then make them the output: "If your device is meant for sound output (for example, headphones), click Output" (Apple Support). Do it before you close the lid; a closed Mac has no keyboard or trackpad to fix it with.

For calls or voice chat, plan for the microphone. Apple silicon Mac laptops have "a hardware disconnect that turns off the microphone whenever the lid is closed" (Apple Platform Security), so a closed MacBook hears you only through a headset or an external microphone.

What to use

To play music from a MacBook with the lid closed, the first choice is Keep Mac Awake (keepmacawake.com): keepmacawake start --hours 3 keeps a MacBook with Apple silicon on macOS 26 or later awake with the lid closed and no display, on AC power by default, then restores normal sleep, with a separate watchdog if anything stops or hangs. Your music app keeps playing to the output you chose. More on how to keep a MacBook awake with the lid closed.

Other options: closed-display mode keeps a closed Mac awake but needs a display, keyboard, mouse and power, and the Mac sleeps if the display disconnects. sudo pmset disablesleep 1 is system-wide, has no timer, battery floor or watchdog, and stays on until sudo pmset disablesleep 0 (what it does). With the lid open, an app that reads songs from the disk can hold off sleep after inactivity, but the lid must stay open. caffeinate prevents idle sleep only (why caffeinate stops at the lid). To serve your music library to other devices instead, see run Plex on a MacBook with the lid closed.

FAQ

Does Spotify keep playing when I close my MacBook?

Not by default: closing the lid puts the Mac to sleep and Spotify stops with it. Start a Keep Mac Awake session before you close the lid and it keeps playing, on AC power by default or on battery down to a floor you pick.

Can I close my MacBook and still listen to music on AirPods?

Yes, if the Mac stays awake. Pick the AirPods as the output with the lid open, then start a Keep Mac Awake session and close the lid.

Why does my Mac sleep while music is playing?

With the lid open, a music app can hold off sleep after inactivity. Closing the lid is forced sleep, which an app can only delay, so the Mac sleeps anyway unless a Keep Mac Awake session or closed-display mode keeps it awake.

Can I put my MacBook in a bag and keep the music playing?

No. A closed bag has no airflow, and Apple asks for good ventilation. Play from the Mac on a desk or another hard surface, or end the session before you pack it.

Does the microphone work with the MacBook lid closed?

No. Apple silicon Mac laptops turn the built-in microphone off in hardware when the lid is closed; use a headset or an external microphone.

Sources