A straight answer first: if your Mac is an iMac, Mac mini or Mac Studio, you don't need a keep-awake app for most jobs. The things that make MacBooks hard — the lid, the battery — don't exist here. Lidwork, our app, is built for closed MacBook lids; on a desktop Mac it would mostly duplicate a checkbox macOS already has.
1. The Energy setting (the main fix)
On macOS Sonoma and later: System Settings → Energy. On Ventura the pane is called Energy Saver. Turn on:
- Prevent automatic sleeping when the display is off — the Mac keeps running even after the screen goes dark. This is the setting that matters.
- Wake for network access — optional; lets the Mac respond to some network requests while asleep. If you've disabled sleep, it hardly matters.
- Start up automatically after a power failure — recommended for home servers and always-on machines.
The exact wording shifts a little between macOS versions, but these options have been in the same pane for years.
2. The display timeout
The screen turning off is not the Mac going to sleep. The display timer is in System Settings → Lock Screen → Turn display off when inactive. With the Energy option above enabled, you can let the display sleep after a few minutes and still keep downloads, renders and servers running — saving power and your panel.
3. Terminal: pmset for exact control
If you manage several Macs, or want settings the GUI doesn't expose, pmset is the source of truth:
# show current settings
pmset -g
# never idle-sleep the system; display sleeps after 10 min
sudo pmset -a sleep 0
sudo pmset -a displaysleep 10
# check for scheduled sleeps / wakes
pmset -g sched
These settings persist across restarts. To undo, set sleep back to a number of minutes, or match the Energy pane again.
4. caffeinate for one-off jobs
For a single long task, it's cleaner not to change settings at all:
caffeinate -i ./backup.sh # awake until the script finishes
caffeinate -i -t 10800 # awake for three hours
When the command ends, normal sleep is back. See every caffeinate flag explained, or build the command with checkboxes in the caffeinate command builder.
5. Menu-bar apps
If you like a toggle in the menu bar, free caffeinate wrappers such as KeepingYouAwake (MIT, brew install --cask keepingyouawake) are a fine fit on desktops. Amphetamine adds schedules and triggers. Neither needs special permissions for desktop use.
Common setups
| Use | Recommended setup |
|---|---|
| Home server, media server, Time Machine target | Energy: prevent automatic sleeping + start after power failure; display off after a few minutes |
| Remote access (SSH, Screen Sharing) | Same, plus Remote Login / Screen Sharing in General → Sharing |
| Overnight render or upload | caffeinate -i + the command, no setting changes |
| Build agent or CI runner | sudo pmset -a sleep 0, managed in your provisioning scripts |
Keeping an always-on Mac efficient
Disabling system sleep on a desktop Mac costs less than people expect — Apple Silicon Mac minis in particular draw very little power at idle. A few habits keep it that way:
- Let the display sleep after a few minutes; it's the biggest power user on an iMac.
- Quit apps that keep the CPU busy in the background —
pmset -g assertionsalso shows which apps are preventing sleep, which is a good hint. - Prefer
caffeinatefor occasional jobs, and leave sleep enabled if the Mac doesn't need to be reachable around the clock. - For a server, enable Start up automatically after a power failure and turn on automatic login only if the Mac is physically secure.
When it still sleeps
- Run
pmset -gand look atsleep— 0 means idle sleep is off. - Run
pmset -g schedfor a scheduled sleep you forgot about. - Run
pmset -g log | grep -E "Sleep|Wake" | tailto see when and why it slept. - Managed (work) Macs can enforce energy settings through a profile; System Settings will show the options as locked.
And if you also have a MacBook
Laptops are different: battery and charger have separate rules, and closing the lid sleeps the Mac regardless. That's covered in how to prevent a MacBook from sleeping — and it's the case Lidwork is made for.
FAQ
Do I need an app like Lidwork on an iMac or Mac mini?
Usually not. Lidwork exists for closed MacBook lids. On a desktop Mac, the built-in Energy setting and caffeinate cover almost every case for free.
Why does my Mac mini still sleep?
Check System Settings → Energy, then run pmset -g to see the sleep value and pmset -g assertions to see what is (or isn't) holding it awake. A scheduled sleep in pmset -g sched can also be the cause.
Can a Mac mini restart by itself after a power cut?
Yes: System Settings → Energy has an option to start up automatically after a power failure. It's useful for always-on home servers.