Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Prevent Sleep on a Mac – Simple Steps to Stay Awake

· 6 min read · Home Tech

In this article
  1. Why Does My Mac Keep Going to Sleep?
  2. How Can I Stop Sleep Mode Permanently Using System Settings?
  3. Can I Use a Simple Command to Keep My Mac Awake?
  4. How Long Does the Awake Setting Last?
  5. What If My Mac Still Sleeps After These Changes?
  6. Before You Start, Check This Quick List
  7. How Do I Verify That Sleep Is Disabled?
  8. What Are Some Safe Alternatives If I Prefer Not to Change System Settings?
  9. How Long Can I Safely Keep My Mac Awake?
  10. What If I Need to Prevent Sleep on Multiple Macs at Once?
  11. When Should I Re‑Enable Sleep?

Open System Settings, go to the Battery pane, and set "Turn display off after" to Never; the change takes only a few minutes and needs no extra software.

Why Does My Mac Keep Going to Sleep?

macOS is designed to conserve energy by dimming the display and entering sleep after a period of inactivity. The default timer is often 10 minutes on a laptop and 5 minutes on a desktop. This behavior can interrupt downloads, presentations, or long‑running scripts. It also happens when the lid closes on a notebook, or when the system detects low battery and switches to power‑saving mode.

When the sleep timer is active, the computer stops most background processes, pauses network connections, and may lock the screen. If you need continuous operation, the built‑in settings must be adjusted or overridden.

How Can I Stop Sleep Mode Permanently Using System Settings?

Changing the sleep timer in the graphical interface works for most users and does not require terminal commands. Follow these steps:

  1. Click the Apple menu  and choose System Settings. The label may appear as System Preferences on older versions.
  2. Select Battery on the left sidebar. If you are using a desktop Mac, choose Energy Saver instead.
  3. In the Battery tab, locate the slider labeled "Turn display off after". Drag it all the way to the right until it reads "Never".
  4. Switch to the Power Adapter tab (or the Power Source section on a desktop). Repeat the same slider adjustment to "Never".
  5. Uncheck the box that says "Put hard disks to sleep when possible" if it appears. This ensures the internal drive stays active.
  6. Close System Settings. The changes take effect immediately.

These settings keep the display on and prevent the computer from entering sleep while it is plugged in. When running on battery, consider leaving a short timeout to preserve charge.

Can I Use a Simple Command to Keep My Mac Awake?

The built‑in caffeinate command creates a temporary block on sleep without altering system preferences. It is useful for one‑off tasks such as rendering a video or running a server.

Open the Terminal application (found in Applications → Utilities) and type the following:

  1. Enter caffeinate -d -i -m -u and press Return. The flags mean:
    • -d: prevent the display from sleeping.
    • -i: prevent the system from idle sleeping.
    • -m: keep the disk from sleeping.
    • -u: declare user activity, which stops the screen saver.
  2. Leave the Terminal window open. The command will run until you close the window or press Control + C.
  3. To set a specific duration, add -t seconds. For example, caffeinate -d -t 7200 keeps the Mac awake for two hours.

The caffeinate approach does not change permanent settings, so once the command ends the Mac returns to its normal sleep schedule.

How Long Does the Awake Setting Last?

When you set the display timer to "Never" in System Settings, the change remains until you modify it again. It applies to both battery and power‑adapter modes, but you can keep a short timeout for battery use to avoid draining the charge.

When using caffeinate, the awake period lasts exactly as long as the command runs. Without the -t flag, the command runs indefinitely. With a time flag, the computer will revert to its previous sleep behavior as soon as the timer expires.

If you install a third‑party utility such as Amphetamine, the app offers profiles that can be scheduled to start and stop automatically. Those profiles follow the same principle: they keep the Mac awake only while the profile is active.

What If My Mac Still Sleeps After These Changes?

Sometimes other settings or external devices override the sleep preferences. Check the following causes:

SymptomPossible CauseFix
Screen blanks after a few minutesScreen saver still activeSystem Settings → Desktop & Screen Saver → Set "Start after" to "Never"
Mac sleeps when lid closesLid‑close action set to "Sleep"System Settings → Desktop & Dock → Uncheck "Put display to sleep when lid is closed" (requires external monitor)
Network disconnects during long downloadsPower nap or Wi‑Fi sleep enabledSystem Settings → Battery → Disable "Enable Power Nap" and "Turn Wi‑Fi off when sleeping"
Mac still sleeps after caffeinate endsAnother app re‑enables sleepQuit background utilities that manage power, such as third‑party battery managers

If none of these resolve the issue, restart the Mac. A fresh boot clears temporary power‑management caches that can sometimes cause unexpected sleep.

Before You Start, Check This Quick List

  • Are you plugged into a power source? Battery mode may enforce a shorter timeout.
  • Do you need the display on, or just the CPU? Adjust the -d flag accordingly.
  • Is any external monitor attached? Some lid‑close settings behave differently with an external display.
  • Do you have any third‑party power‑management apps installed? They may conflict with System Settings.

How Do I Verify That Sleep Is Disabled?

After adjusting settings, you can test the behavior:

  1. Leave the Mac idle for the previous sleep interval (e.g., 10 minutes).
  2. Observe whether the display stays lit and the menu bar remains responsive.
  3. If you used caffeinate, open Activity Monitor and look for the caffeinate process. Its presence indicates the block is active.

If the Mac still enters sleep, repeat the symptom table steps to locate hidden settings.

What Are Some Safe Alternatives If I Prefer Not to Change System Settings?

Third‑party utilities like Amphetamine or KeepingYouAwake provide a graphical toggle that runs caffeinate in the background. They let you enable an awake profile with a single click and automatically stop after a preset period. These apps are sandboxed, so they do not modify core preferences and can be removed easily.

Another option is to play a silent audio track in a loop. Media players such as QuickTime keep the system awake while audio is playing. This method is less reliable because muting the sound may still allow the system to sleep on some machines.

How Long Can I Safely Keep My Mac Awake?

Keeping a Mac awake indefinitely does not damage the hardware. Modern Macs are designed to run continuously. However, prolonged display-on time can increase screen wear and consume more electricity. If you only need the CPU active, use caffeinate -i without the -d flag to let the display turn off while the system stays awake.

For long rendering jobs, schedule a nightly sleep window after the task completes. This balances energy use with uninterrupted performance.

What If I Need to Prevent Sleep on Multiple Macs at Once?

Use a mobile device or a remote management tool that can send the caffeinate command over SSH. Example steps:

  1. Enable "Remote Login" in System Settings → Sharing on each Mac.
  2. From your iPhone or another computer, open a terminal and run ssh user@mac.local "caffeinate -i -t 14400" to keep each machine awake for four hours.
  3. Verify the connection succeeds and the caffeinate process appears in Activity Monitor on each target.

This method scales without installing extra software on each device.

When Should I Re‑Enable Sleep?

Re‑enable sleep when you no longer need continuous operation. Returning the "Turn display off after" slider to a reasonable value (e.g., 5 minutes on battery, 15 minutes on power) restores energy savings. Disable any temporary caffeinate processes by closing the Terminal window or pressing Control + C. Finally, consider setting a nightly sleep schedule in System Settings → Battery → Schedule, so the Mac powers down automatically at a convenient hour.