keepcalculator

06 Numbers and Powers

Prevent Mac From Sleeping: 7 Ways That Work

Card No. 06·14054 · Updated · Standard formula, shown below

To prevent your Mac from sleeping, you can adjust the Energy Saver (or Battery) settings in System Settings, use the caffeinate command in Terminal, or use a third-party app like Amphetamine. The method you choose depends on whether you need a permanent setting, a temporary fix, or a per-app solution.

Why Your Mac Sleeps (and Why You Might Want to Stop It)

macOS puts your Mac to sleep to save power and extend the life of the display and battery. When idle for a set period, the display turns off first, then the whole system enters a low-power state. This is usually desirable, but it becomes a problem when you’re doing something that requires the Mac to stay awake: downloading a large file, rendering a video, giving a presentation, or running a script overnight. A sleeping Mac pauses all these tasks, which can lead to failed downloads, interrupted renders, or a presentation that goes dark at the worst moment.

Method 1: System Settings (The Permanent Solution)

The most straightforward way to prevent sleep is through macOS settings. The exact menu names vary slightly by macOS version, but the steps are essentially the same.

  1. Open System Settings (or System Preferences on older macOS).
  2. Click Battery (on a MacBook) or Energy Saver (on a desktop Mac).
  3. On a MacBook, click Options and then set the “Turn display off on battery when inactive� and “Turn display off on power adapter when inactive� sliders to Never. Also uncheck “Put hard disks to sleep when possible.� On a desktop Mac, set the “Turn display off� slider to Never and uncheck “Put hard disks to sleep when possible.�
  4. If you want to prevent sleep entirely, also uncheck “Enable Power Nap� (on some models) or set it to “Only on power adapter� if you still want background updates.

This method keeps your Mac awake indefinitely until you put it to sleep manually or restart. Note that on a MacBook, running on battery with the display never off will drain the battery quickly, so consider plugging in.

Method 2: The caffeinate Command (Temporary, Precise)

For a one-time or scripted need, the built-in caffeinate command is ideal. It prevents the Mac from sleeping for a specified duration or until you stop it.

  1. Open Terminal (in /Applications/Utilities/).
  2. Type caffeinate -d and press Enter. The -d flag prevents the display from sleeping, and the system will stay awake as long as the command runs.
  3. To run it for a specific time, use caffeinate -d -t 3600 (3600 seconds = 1 hour).
  4. To stop it early, press Control+C in the Terminal window.

You can also combine it with a command that must finish, like caffeinate -d -i make build – the Mac stays awake until the command completes. This is a favourite among developers and power users because it doesn’t require any extra software.

Method 3: Third-Party Apps (For Convenience and Control)

If you want a menu-bar toggle or per-app rules, a third-party app is easier than Terminal. The most popular is Amphetamine (free on the Mac App Store). It adds a small icon to your menu bar. Click it and choose “Indefinitely� or a set duration. You can also set rules like “Keep awake while this app is open� or “while on this Wi-Fi network.� Other options include KeepingYouAwake (also free) and Theine. These apps essentially run the same caffeinate command in the background, but they give you a friendly interface.

Method 4: Use an External Display (Lid Closed on MacBook)

On a MacBook, closing the lid usually forces sleep. But if you connect an external display, a keyboard, and a mouse (or use a clamshell stand), you can close the lid and the Mac stays awake. This works when the Mac is connected to power. To enable this, simply have the external display connected and the Mac plugged in – macOS will automatically keep it awake when the lid is closed. This is a common setup for using a MacBook as a desktop. If it doesn’t work, check the Battery settings and ensure “Prevent automatic sleeping on power adapter when the display is offâ€� is unchecked (or enabled, depending on your macOS version – the setting is often called “Slightly dim the display on battery while on power adapterâ€� or similar).

Common Problems and Misconceptions

One frequent issue: you’ve set “Neverâ€� for the display, but the Mac still sleeps. This is usually because the “Prevent automatic sleeping when the display is offâ€� checkbox is not checked. On newer macOS, this option is hidden under Battery > Options. Another misconception is that Power Nap keeps your Mac awake – it doesn’t. Power Nap allows the Mac to do background tasks while sleeping, but it still sleeps. Also, some apps (like video players) can prevent sleep while playing, but this is not guaranteed. If you’re using a browser to watch a video, the browser may not trigger the “media playbackâ€� prevention on all sites.

How to Choose the Right Method

  • Permanent setting: Use System Settings if you rarely want the Mac to sleep (e.g., a server or a desktop always plugged in).
  • Temporary, one-time: Use caffeinate in Terminal for a download or a build.
  • Frequent, user-friendly: Use a menu-bar app like Amphetamine for quick toggles.
  • MacBook with external display: Use clamshell mode for a desktop-like setup.

Safety and Battery Life Considerations

Preventing sleep has trade-offs. On a MacBook, keeping the display on and the system awake will drain the battery faster. Over time, heat from continuous heavy use can reduce battery health, though modern Macs manage thermals well. It’s also worth noting that leaving a MacBook plugged in at 100% for days can degrade the battery, so macOS has an optimized battery charging feature that you should leave on. For desktop Macs, the main concern is electricity consumption – an iMac or Mac mini left awake 24/7 uses more power, but it’s generally safe. Always ensure proper ventilation if you’re running demanding tasks for hours.

Frequently Asked Questions

How do I stop my Mac from sleeping when the lid is closed?

If you have an external display and the Mac is plugged in, closing the lid should keep it awake. If not, check System Settings > Battery > Options and make sure “Prevent automatic sleeping on power adapter when the display is off� is enabled. Some users also use a third-party app like Amphetamine with a “closed-display mode� to override the default.

Does caffeinate drain the battery?

Yes, caffeinate prevents the system from entering low-power states, so the battery will drain faster than if the Mac were sleeping. The exact drain depends on what the Mac is doing – a simple idle with the display on uses less than a heavy render.

Why does my Mac still sleep after I set “Never� in System Settings?

This usually happens because the “Prevent automatic sleeping when the display is offâ€� checkbox is not checked. On macOS Ventura and later, go to System Settings > Battery > Options and check that box. Also, make sure no screen saver is set to “Start afterâ€� a short time – a screen saver can trigger sleep if it’s set to “Use with display sleep.â€�

Is there a way to keep the display on but allow the system to sleep?

Yes, you can set the display to turn off (e.g., after 10 minutes) but leave the system awake by checking “Prevent automatic sleeping when the display is off.â€� This is useful for tasks that don’t need the screen but must keep running, like downloads.

Can I schedule when my Mac sleeps?

Yes, in System Settings > Battery > Options (or Energy Saver), you can click “Schedule� to set a start and wake time. This is useful if you want the Mac to sleep at night but be awake during work hours.

What is the difference between sleep and display off?

Display off just turns off the screen – the system stays awake and runs tasks. Sleep puts the entire system into a low-power state, pausing most processes. You can have the display off while the system stays awake, but you cannot have the display on while the system sleeps.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →