Prevent Mac Sleeping When Display Is Off
In this article
This guide shows you how to keep your Mac awake while the display turns off, useful for downloads, file transfers, or when using it as a media server. You can achieve this with built-in settings, a free utility, or a Terminal command — no extra hardware needed.
What You'll Need
- A Mac running macOS (any recent version, including Sonoma or Ventura)
- Administrator access (to change system settings)
- Optional: caffeinate (built-in Terminal command) or a third-party app like Amphetamine (free on the Mac App Store)
Step-by-Step
Method 1: Using System Settings (Built-in)
- Click the menu and select System Settings (or System Preferences on older macOS).
- Click Battery (or Energy Saver on older versions).
- Click Options (or the Power Adapter tab).
- Look for the setting Prevent automatic sleeping when the display is off (or Prevent computer from sleeping automatically when the display is off).
- Enable the checkbox next to it. The exact wording may vary, but it’s usually under “Battery” or “Power Adapter” settings.
- Close the window. Your Mac will now stay awake even when the display turns off.
Method 2: Using Terminal (caffeinate)
- Open Terminal (found in /Applications/Utilities/).
- Type the following command and press Enter:
caffeinate -s
This prevents the system from sleeping while connected to AC power. - To stop it, press Ctrl+C in the Terminal window.
- For a timed duration, use:
caffeinate -s -t 3600(keeps awake for 1 hour, then stops). - To keep it running even if you close Terminal, add
&at the end:caffeinate -s &. To stop it later, typekillall caffeinate.
Method 3: Using a Third-Party App (Amphetamine)
- Download Amphetamine from the Mac App Store (free).
- Open the app; it appears as a pill icon in the menu bar.
- Click the pill and choose Start to keep the Mac awake indefinitely.
- To allow the display to sleep while keeping the system awake, go to Preferences → General and check Allow display sleep.
- You can also set a timer or trigger based on app activation.
Common Mistakes
- Only setting the display sleep timer — this controls the display, not the system sleep. You must also disable system sleep separately.
- Forgetting to check both battery and power adapter settings — on laptops, the setting may differ between battery and plugged-in modes.
- Using caffeinate without the -s flag — plain
caffeinateonly prevents idle sleep, but not sleep triggered by closing the lid or other factors. The -s flag is essential for AC power. - Closing Terminal while caffeinate is running — this stops the command. Use
nohupor the&background trick if needed.
Tips
- If you’re using a laptop, keep it plugged in when preventing sleep for long periods to avoid battery drain.
- Use
caffeinate -dto prevent the display from sleeping as well (useful for presentations). - Create a simple Automator app or a shell script that runs
caffeinate -swith a click, so you don’t have to type commands each time. - For scheduled tasks, use
pmsetin Terminal:sudo pmset -a sleep 0disables sleep entirely (until you set it back).
Troubleshooting
- Setting doesn’t stick after restart: Some third-party utilities or energy saver preferences may override it. Check if any app like “KeepingYouAwake” or “Amphetamine” is running and conflicting.
- Mac still sleeps after setting: Verify you changed the correct setting — there are separate options for “system sleep” and “display sleep”. Ensure “Prevent automatic sleeping when the display is off” is checked.
- caffeinate doesn’t work: Make sure you’re using the correct flag.
-sworks only when connected to AC power; if on battery, use-c(but that may drain battery fast). - Display turns off but system sleeps after a few minutes: Some Macs have a separate “hard disk sleep” timer. Go to System Settings → Battery → Options and set “Put hard disks to sleep when possible” to Never.
- App not working after macOS update: Third-party apps may need permissions. Check System Settings → Privacy & Security → Accessibility or Automation for the app.
Frequently Asked Questions
Does preventing sleep damage my Mac?
No, it’s safe to keep your Mac awake for extended periods. It may use more electricity and generate heat, but modern Macs are designed to run 24/7.
Will this work on a MacBook on battery?
Yes, but the system may still sleep to save battery if you don’t disable the battery sleep setting. For best results, keep it plugged in.
Can I set a specific time for the Mac to sleep?
Yes, use the pmset command or schedule in System Settings → Battery → Options → Schedule (on some macOS versions).
Is there a way to keep the display off but the system awake without Terminal?
Yes, use the System Settings method (Method 1) or a third-party app like Amphetamine that has a “display sleep” toggle.
What does the caffeinate command do exactly?
It creates a temporary assertion that prevents the system from sleeping. The -s flag prevents idle sleep while on AC power, and -d prevents display sleep.
Will this interfere with scheduled backups or updates?
No, it actually helps. Time Machine backups and macOS updates often require the Mac to be awake, so preventing sleep ensures they complete.