Mac Goes to Sleep While Playing Music on External Display
Mac sleeps and music stops when speakers are in an external display or YouTube plays in a background tab? Find which sleep it is and fix it.
GuideUpdated 7 min read
On this page
You're listening through speakers built into an external display, or to a YouTube tab you aren't looking at, and the music stops after a while. You've tried the "prevent sleeping" option or caffeinate and it didn't help. This guide separates the causes and gives a fix for each.
Why the music stops
Several different things look like "my Mac went to sleep". Most common first:
- Only the display sleeps. The Mac keeps running, but the monitor turns off. Speakers in the monitor are an audio output over the display cable (HDMI or DisplayPort), so they can go silent when the display sleeps or drops its link. This is my reading of the symptom, not something Apple documents. A quick test below confirms it.
- Nothing is holding the Mac awake. macOS decides idle sleep by looking for apps that block it. A browser playing audio from a background tab may or may not take that hold, depending on the browser and the page. Users in public threads report the Mac sleeping during YouTube playback from a tab that wasn't active. We can't say which browsers do this.
- A hot corner or schedule. A Hot Corner set to put the display to sleep, a scheduled sleep, or an auto log-out can look like random sleep.
- The lid is closed. A MacBook with its lid closed only stays usable with power and an external keyboard and mouse connected. Apple's page on dark external displays says to check this for a Mac laptop with a closed lid.
- A flaky cable, port or dock. If the display link drops, the speakers in the monitor vanish with it. One person on a public thread suspected this. Nothing in a sleep setting fixes it.
Tell display sleep from system sleep
Play music and wait for it to stop. Then move the mouse or press a key.
- If the music resumes by itself, or the screen was just dark, it was display sleep.
- If the Mac needs a wake and the song restarts, the whole system slept.
You can also read what is holding the Mac awake while music plays:
pmset -g assertionsThis only reads the current sleep-blocking assertions and changes nothing. If no entry mentions the audio app or a system audio process, nothing is protecting the session.
Fix 1: use the built-in settings
This is free and worth doing first.
- Open System Settings and click Battery in the sidebar (on a desktop Mac, Energy).
- On a laptop, click Options. Turn on Prevent automatic sleeping on power adapter when the display is off. Apple documents this in its sleep and wake settings page.
- Open Lock Screen and set Turn display off on power adapter when inactive to a time longer than your listening sessions.
- Open Desktop & Dock, check Hot Corners, and make sure none is set to put the display to sleep. Search the Settings box for "Hot Corners" if you can't find it.
Limits: step 2 only applies on the power adapter, and it does not react to music. It also does not keep the display on, so step 3 is what protects speakers inside a monitor.
Fix 2: run caffeinate correctly
caffeinate is built into macOS. This blocks display sleep and idle system sleep until you stop it:
caffeinate -diFor a fixed time, add seconds: caffeinate -di -t 7200 runs for 2 hours. Press Control-C to stop. Nothing is changed permanently.
If it "didn't work", the usual reasons are:
- The Terminal window or tab was closed, which ends the command.
- The Mac was already asleep when you started it.
- You ran
caffeinate -ior-salone, which doesn't keep the display on. - The lid was closed, or the cable dropped the display link.
More flags are in our caffeinate guide.
Fix 3: keep the Mac awake only while audio plays
A rule in Glowmoth does what the built-in setting can't: it reacts to sound. Glowmoth is a menu bar app we make. Its Audio Playing condition is true while any audio output device is running. It looks at the device, not at the app or browser tab, so a background YouTube tab counts. It is checked about every 5 seconds, so expect a short delay.
- Right-click the moth icon in the menu bar and choose Settings… (⌘,).
- Open the Automation tab. Make sure Keep awake automatically is on (it is by default).
- Under Rules, choose Add Rule, then Custom Rule….
- Name it, for example "Music playing".
- Choose Add Condition, then More, then Audio Playing.
- Turn on Keep the display on. It is off by default, which means only the Mac stays awake and the display sleeps as usual. For speakers in the monitor, you want it on.
- Click Add Rule (or press Return).
To check it works, play something and open the panel (left-click the icon, or Option-click). The rule should appear under Held By, and the icon shows the Automatic state. Open Show More and look at Also Keeping This Mac Awake. It lists other apps holding the Mac awake, with a purpose such as "playing video".
The rule is true only while audio plays. When the music stops, your normal sleep settings apply again.
Compare the options
| Option | Cost | Reacts to audio | Keeps display on | Main limit |
|---|---|---|---|---|
| Battery setting | Free | No | No | Only on power adapter |
caffeinate -di | Free | No | Yes | Stops when Terminal closes |
| Glowmoth rule | $349 one-time for all MacSuite apps (as of November 2026), 7-day trial | Yes | Yes, if the switch is on | Can't fix a bad cable |
| Amphetamine | Free | Yes, via a trigger | Per its settings | Last updated November 2023 |
As of November 2026, Amphetamine is a free App Store app with 15 trigger types, audio among them. If you already use it, add an audio trigger there. You don't need another app for this job.
If it still sleeps
Check the display link
If music stops even with a rule active, suspect the link. Apple's guidance for a dark display includes disconnecting the display from your Mac and its power source, then reconnecting it, and connecting to a port directly on your Mac if you use a hub or dock. See Apple's page on external displays that are dark or low resolution.
To isolate it, switch output to another device in System Settings > Sound > Output. If the music keeps playing there, the cable, port, dock or monitor is the likely cause.
Check Glowmoth's states
- Paused. On battery, Glowmoth pauses below its battery floor (20% by default) and when macOS reports the Mac is running hot. Plug in, or use Resume Anyway (30 min).
- Manual mode. Manual ignores every automatic reason, including rules. Switch the panel back to Automatic.
- Stop Everything. It suspends automatic reasons until you start a session or relaunch Glowmoth.
- Trial ended. With no valid license, nothing is kept awake. Use Enter License….
Closed lid
Blocking idle sleep does not keep a closed MacBook running. See our clamshell mode guide. Glowmoth has an optional closed-lid mode for laptops, covered in its closed-lid docs.
Apple also covers unexpected sleep and wake, including sharing services that affect sleep.
Checklist before you try again
- Music stops with the screen dark: display sleep, so the display needs a hold.
- Prevent automatic sleeping on power adapter when the display is off is on.
- No Hot Corner puts the display to sleep.
- The lid is open, or the Mac has power plus a keyboard and mouse.
- Output on another device doesn't stop (rules out the cable).
- Glowmoth rule: Audio Playing added, Keep the display on on, panel set to Automatic.
If nothing works
If the audio still drops on a different output and the Mac stays awake, the fault is likely the monitor, cable or port. Contact the monitor maker, or Apple Support if it is an Apple display or a port issue. For Glowmoth, use our support page. Include the macOS version, the Mac and monitor models, how it's connected, and the output of pmset -g assertions taken during playback.
Subject: Mac sleeps while music plays through external display speakers
Mac model / macOS version:
Display model and cable/dock:
Audio output: speakers in the external display
What happens: music stops after about ___ minutes. Screen dark? Yes/No
Steps tried: Battery option on, caffeinate -di, Glowmoth Audio Playing rule
pmset -g assertions output (during playback): attachedGlowmoth in short
If you want sleep blocked only while sound is playing, and want it to work for a YouTube tab you can't see, the Audio Playing rule is the closest fit. It is part of MacSuite, with a 7-day free trial. See the Glowmoth page, the rules docs and troubleshooting. It only holds the Mac awake. It can't repair a failing cable and doesn't block a manual sleep from the Apple menu.
Common questions
Does caffeinate work for YouTube in a background tab?
Yes, while the command is running. It ignores the tab and the sound, so leave it running for the whole session.
Why does the sound stop but the Mac seem awake?
Probably display sleep: the monitor's audio path goes with it. Keep the display on, or use a different output such as the Mac's own speakers or headphones.
Will a rule drain my battery?
On battery, the rule holds the Mac awake while audio plays, which uses power. Glowmoth's low-battery pause is on by default and stops it below the floor.
Does the rule keep the Mac awake after the music stops?
No. It is true only while an audio output device is running.