Profiles Switcher › Blog

How to Keep Your Mac Awake When Plugged In (4 Ways)

By the Profiles Switcher team. Published .

To keep a Mac awake when it is plugged in, open System Settings > Battery > Options and turn on "Prevent automatic sleeping on power adapter when the display is off". To keep it awake only at your desk, use a profile that prevents sleep while an external display and the charger are connected.

Awake only at the desk: an external display and the charger, both required.

Set this up with Profiles Switcher on the Mac App Store, or start from a ready-made recipe.

1. What is the quickest setting?

On macOS Sequoia and Tahoe, open System Settings > Battery, click Options and turn on Prevent automatic sleeping on power adapter when the display is off. The Mac then keeps running on the charger even when the screen turns off. MacRumors and Six Colors cover where these settings moved in recent macOS versions.

This is a global switch: it applies wherever the Mac is plugged in.

2. How do you keep the display on too?

The display has its own timer. In System Settings > Lock Screen, set Turn display off on power adapter when inactive to a longer time, or Never. Use it with care on an OLED or older display, and remember it applies to every charger, not just your desk.

3. How do you keep a Mac awake for one task?

macOS includes a Terminal command called caffeinate. It holds the Mac awake while it runs:

It is perfect for a one-off download or render, and easy to forget in a Terminal tab.

4. How do you keep a Mac awake only at your desk?

Tie it to the desk itself. A profile with two rules, Any external display attached and On AC power, set to All are true, describes your desk precisely. Add the Prevent sleep action and choose:

Profiles Switcher uses the same macOS mechanism as caffeinate, a power assertion, but switches it on when you dock and releases it as soon as another profile takes over, for example when you unplug the display. The keep awake when docked recipe has the steps.

Can a MacBook stay awake with the lid closed?

Yes, in closed-display mode, often called clamshell mode: the MacBook needs to be on the charger and connected to an external display (with an external keyboard and mouse or trackpad to use it). Without an external display, closing the lid puts the Mac to sleep even when sleep is prevented, because preventing sleep only stops idle sleep.

That is also why a Laptop lid rule set to “closed” stays active only in clamshell mode: on its own, a closed laptop goes to sleep a moment later.

Frequently asked questions

Will my MacBook stay awake with the lid closed?

Only in closed-display (clamshell) mode, with the charger and an external display connected. Without them, closing the lid puts a MacBook to sleep, whatever the sleep settings.

Is keeping a Mac awake bad for the battery?

On the charger it mostly just uses a little more power. On battery, preventing sleep drains it faster, which is why the automatic approach only keeps the Mac awake while it is plugged in.

What does caffeinate do?

caffeinate is a command built into macOS that prevents sleep while it runs. For example, caffeinate -d keeps the display awake until you stop the command.

Ready-made automations for this

powerdeskhow-to

Let your Mac switch its own setup

Profiles Switcher is a menu bar app for Mac (macOS 13 or later, Apple Silicon and Intel) that switches your Mac's setup automatically. You build profiles from 19 triggers, such as the Wi-Fi network you join, a place, headphones or a display, and 18 actions, including running any of your Shortcuts. Everything runs on your Mac; it is available on the Mac App Store.

Download on the Mac App Store