How to prevent Mac from sleeping

Sleepover is a menu bar switch that keeps an idle Mac from sleeping, built for the times you want it awake. Click the owl and the Mac stays awake until you click again, or for a length you pick, and one switch decides whether the display stays on. It needs a Bravely Account with the Mac Utility Bundle or Bravely Premium.

  • For one job: caffeinate, which can last exactly as long as a command runs.
  • For a click: Sleepover, from the menu bar.
  • Closing a MacBook is a different kind of sleep. Sleepover doesn't stop it, and the FAQ says what does.

Part of the Mac Utility Bundle. One payment of $19.99 unlocks all five, on every Mac you own.

Your options for keeping a Mac awake

  • Built in

    System Settings

    Cost
    Included with macOS
    Good for
    A Mac that should stay awake as a rule: a desktop that shares files, or a laptop that lives plugged in at a desk. You set it once.
    Downside
    It stays that way for everything until you change it back, and on a laptop Apple's switch is for the power adapter: its guide lists none for battery power.

    Apple Support: Set sleep and wake settings for your Mac

  • Built in

    caffeinate

    Cost
    Included with macOS
    Good for
    One long job, for anyone at home in Terminal. There's nothing to install and nothing to buy.
    Downside
    A Terminal window stays open while it runs, a time limit is counted in seconds, and nothing in the menu bar shows that it's on.

    Apple: the caffeinate manual page (caffeinate.8)

  • Free

    Amphetamine

    Cost
    Free on the Mac App Store
    Good for
    A free switch in the menu bar that does more than ours. Its listing says a session can run indefinitely, for a set time or until a set time, and it lists a mode for a MacBook with its display closed.
    Downside
    There's a lot to set up if all you want is on and off, and the listing shows its last update as version 5.3.2, on November 10, 2023.

    Amphetamine: its store listing (apps.apple.com)

  • Our app

    Sleepover

    Cost
    Mac Utility Bundle: $19.99 once for five apps
    Good for
    One click on an owl in the menu bar, five timed lengths in its menu with the time left shown, and one switch for whether the display stays on.
    Downside
    It needs a Bravely Account with the Mac Utility Bundle or Bravely Premium.

How to keep a Mac awake with Sleepover

  1. Install it and sign in

    Download Sleepover, open the disk image and drag Sleepover into your Applications folder.

    Open it. The first window is sign-in, and there's no way past it: use your Bravely Account. If that account doesn't have the Mac Utility Bundle yet, the next window offers it. Choose Get the Mac Utility Bundle, pay in your browser, and Sleepover unlocks by itself when the payment goes through.

  2. Click the owl

    Sleepover lives in the menu bar as a pair of owl eyes, and has no Dock icon. Click them. They turn amber, and the Mac stays awake. Click again and the eyes fade: the Mac sleeps normally.

    Out of the box a click has no end, so the Mac stays awake until you click again. To make a click end by itself, right-click the owl, choose Settings… and change Default duration from Indefinitely to a length.

  3. Pick a length

    Right-click the owl and choose For 15 Minutes, For 30 Minutes, For 1 Hour, For 2 Hours or For 4 Hours. When the time is up, Sleepover lets the Mac sleep again without being asked. Keep Awake Indefinitely, the first choice in the list, is the one that never ends by itself.

    The top line of the same menu tells you where you are: Awake: 42m left, Awake until you turn it off or Sleeping normally. Choosing another length starts a new session of that length.

  4. Screen on, or dark

    In Settings…, Also keep the display awake starts switched on, so the display stays lit along with the Mac. Turn it off and the Mac keeps working while the display may sleep, which is what you want for a download you aren't watching.

    You can flip the switch in the middle of a timed session. The countdown carries on.

  5. Stop early

    Click the owl, or right-click it and choose Let It Sleep. Quitting Sleepover, signing out and shutting the Mac down end a session too.

Change your sleep settings

Apple splits sleep across two places in System Settings, and the names below are the ones in its current Mac User Guide. The first is Lock Screen, which has a pop-up menu for each power source. They decide when the display turns off.

The second decides whether the Mac itself may sleep after that. On a laptop, click Battery, then Options. On a desktop such as an iMac or a Mac mini, click Energy, which macOS 14 calls Energy Saver.

  • Lock Screen: "Turn display off on power adapter when inactive", and the same menu for battery power.
  • Battery, Options (laptops): "Prevent automatic sleeping on power adapter when the display is off".
  • Energy (desktops): "Prevent automatic sleeping when the display is off".

Use caffeinate in Terminal

Open Terminal (it's in Applications, Utilities) and type one of the lines below. Apple's manual says the command prevents idle sleep until it exits, so it lasts until you press Control-C in that window, or until its time limit runs out.

That's most of what people need. Every other flag, with what each one really holds awake, is on the caffeinate command page.

  • caffeinate keeps the Mac awake and lets the display sleep.
  • caffeinate -d keeps the display on as well.
  • caffeinate -t 3600 ends by itself after an hour. The number is seconds.
  • caffeinate -i make keeps the Mac awake for as long as the command after it (here, make) is running. It's the example in Apple's manual.

Display sleep or system sleep: which one to stop

There are two sleeps, and all three ways let you treat them separately. When the display sleeps the screen goes dark and the Mac carries on. When the system sleeps, the work stops too.

Keeping the display on also keeps the Mac awake. Apple's notes on the display assertion say that while the display is prevented from dimming, the system cannot go into idle sleep.

  • Keep the screen lit for a presentation, a dashboard, or a recipe you're reading: lengthen the Lock Screen timers, run caffeinate -d, or leave Sleepover's Also keep the display awake on.
  • Let the screen go dark and keep the Mac working for a download, an upload, a backup or a render: turn on the Battery or Energy switch, run plain caffeinate, or turn Sleepover's display switch off.

What Sleepover doesn't do

  • It doesn't keep a MacBook awake with the lid closed. It stops the sleep that comes from sitting idle, and nothing else.
  • It doesn't stop a sleep you choose from the Apple menu, or the one a nearly empty battery forces.
  • It works the same unplugged as plugged in, and it won't switch itself off as the battery runs down. Away from a charger, a timed session is the careful choice.
  • It never turns itself on. There's no schedule, and no rule tied to a program, a download, a charger or a network.
  • The menu's timed choices stop at 4 hours. Past that, the choice is Keep Awake Indefinitely, which you end yourself, or the sleepover command in Terminal, which takes any length up to a week.
  • No key toggles it, and it has no Shortcuts or AppleScript actions.

FAQs

How do I stop my MacBook from sleeping when I close the lid?

Closing a MacBook puts it to sleep, and stopping idle sleep doesn't change that: Apple's notes on the two power assertions behind caffeinate -i and -d, which are the two Sleepover uses, say the Mac may still sleep when it's closed. Apple's MacBook Air guide says that with an external display and accessories such as a keyboard and mouse connected, you can keep working with it closed. Among the free apps, Amphetamine lists a closed-display mode, and KeepingYouAwake's README says it doesn't work on a closed MacBook.

How do I turn off sleep mode on a Mac for good?

In System Settings. On a desktop, click Energy and turn on "Prevent automatic sleeping when the display is off". On a laptop, click Battery, then Options, and turn on "Prevent automatic sleeping on power adapter when the display is off". Then set the display's own timers under Lock Screen. You can still put the Mac to sleep yourself from the Apple menu.

How do I prevent an iMac or Mac mini from sleeping?

On a desktop Mac the pane is Energy, not Battery. Open System Settings, click Energy (Energy Saver on macOS 14) and turn on "Prevent automatic sleeping when the display is off". The display can still turn off on the Lock Screen timer while the Mac stays up.

Does keeping a Mac awake use more power?

Yes. Apple's own guide warns that preventing sleep may increase power consumption. It's the reason to prefer something that ends: caffeinate with a time limit, or a timed session in a menu bar app, over a setting you may forget to change back.

How do I see what is keeping my Mac awake?

Open Terminal and run pmset -g assertions. Apple's manual says it displays a summary of power assertions, the requests that hold off sleep, each under the name its program gave it. A running caffeinate is listed as "caffeinate command-line tool", and the name Sleepover gives its own is "Sleepover is keeping your Mac awake".

Sleepover icon

Sleepover

Keep-awake

Part of the Mac Utility Bundle. One payment of $19.99 unlocks all five, on every Mac you own.