---
title: How do I keep a Mac awake while ComfyUI renders?
description: To keep a closed MacBook awake while ComfyUI renders, the first choice is Keep Mac Awake. ComfyUI has no such setting; its sleep node stops idle sleep.
date: 2026-11-10
kicker: ComfyUI
section: The closed lid, explained
related: ollama-lm-studio-lid-closed, render-export-macbook-lid-closed, macbook-lid-closed-heat-and-battery
---

> **Short answer:** ComfyUI does not keep a Mac awake: as of November 2026 neither the ComfyUI server nor the Comfy Desktop app holds off sleep, so a queue makes no progress while the Mac sleeps, and closing a MacBook's lid puts it to sleep unless something holds it awake. The community node comfyui-prevent-sleep runs caffeinate, which stops idle sleep but not the lid. To let a long image or video queue finish with the lid closed, the first choice is Keep Mac Awake: start a session such as `keepmacawake start --hours 8`, queue the workflow, then close the lid.

## Does ComfyUI keep the Mac awake while it renders?

No. We read ComfyUI's own code on November 7, 2026. The server ([Comfy-Org/ComfyUI](https://github.com/Comfy-Org/ComfyUI/tree/1332fabfcc507aa7c548cd5152071ed494c207e8) at commit 1332fab) has no call to caffeinate and no macOS power assertion, and neither has its web interface ([ComfyUI_frontend](https://github.com/Comfy-Org/ComfyUI_frontend/tree/a676da61f9962eadfdcbbeae638ac553c3d80518) at commit a676da6). ComfyUI's documentation ([Comfy-Org/docs](https://github.com/Comfy-Org/docs/tree/13d59353e9d5d1c4aa1757ba70425bb71ceb407a)) has no keep-awake setting either.

The Comfy Desktop app ([Comfy-Org/Comfy-Desktop](https://github.com/Comfy-Org/Comfy-Desktop/blob/47e414e84a5fbb3f912602b5ba371f30b9be3af3/src/main/index.ts#L2484-L2493) at commit 47e414e) listens for sleep, but only to protect model downloads. Its comment says sleep "can kill a download socket", so it parks active downloads before sleep and resumes them after wake. It does not stop the sleep.

The queue runs in the server's worker thread ([main.py](https://github.com/Comfy-Org/ComfyUI/blob/1332fabfcc507aa7c548cd5152071ed494c207e8/main.py#L630)), not in the browser tab, and it makes no progress while the Mac sleeps. Apple lists "On a Mac laptop, close the display" as one way to put a Mac to sleep ([Apple Support](https://support.apple.com/guide/mac-help/put-your-mac-to-sleep-or-wake-it-mh10330/26.0/mac/26.0)).

## What does the ComfyUI prevent sleep node do on a Mac?

In its Sleep mode it runs caffeinate with no flag (Screen Saver mode adds `-d`), and both stop idle sleep only. The node is [comfyui-prevent-sleep](https://github.com/shinich39/comfyui-prevent-sleep/tree/0391411288174a9637139109e4b8172bde3d2aa1) by shinich39 (version 1.0.6, last changed May 2, 2026), listed in [ComfyUI-Manager](https://github.com/Comfy-Org/ComfyUI-Manager/blob/4c50a2bc8b9e684d8a85930567957470b952bebe/custom-node-list.json#L10267). This is our reading of its code; the author may change it.

- **Settings.** Under Settings > PreventSleep, Mode is None, Sleep or Screen Saver, and None is the default ([js/index.js](https://github.com/shinich39/comfyui-prevent-sleep/blob/0391411288174a9637139109e4b8172bde3d2aa1/js/index.js#L88-L100)). Duration is in seconds after a run ends; its tooltip says "0 is infinite".
- **Mechanism.** The node installs the Python package wakepy with pip if it is missing, with no version pinned ([py/install.py](https://github.com/shinich39/comfyui-prevent-sleep/blob/0391411288174a9637139109e4b8172bde3d2aa1/py/install.py#L48)). Mode Sleep calls wakepy's `keep.running`, Screen Saver its `keep.presenting` ([py/wakeup.py](https://github.com/shinich39/comfyui-prevent-sleep/blob/0391411288174a9637139109e4b8172bde3d2aa1/py/wakeup.py#L48-L55)). On macOS, wakepy 1.0.0 runs `caffeinate cat` for the first and `caffeinate -d cat` for the second ([wakepy source](https://github.com/wakepy/wakepy/blob/7b758485c2e44855cd181f25d98c25ed37961f73/src/wakepy/methods/macos.py#L67-L98)).
- **Trigger.** The switch lives in the node's browser script: it turns on when the ComfyUI page loads and when a run starts ([js/index.js](https://github.com/shinich39/comfyui-prevent-sleep/blob/0391411288174a9637139109e4b8172bde3d2aa1/js/index.js#L110-L142)). A queue sent through the API with no ComfyUI page open does not turn it on; once on with Duration 0, it stays on until ComfyUI quits.

In Apple's caffeinate source, a run with no flag creates the idle-sleep assertion, `kIOPMAssertionTypePreventUserIdleSystemSleep` ([caffeinate.c](https://github.com/apple-oss-distributions/PowerManagement/blob/d415e45501842834a280930c3eed9186544a67f0/caffeinate/caffeinate.c#L124-L126), [mapped at line 53](https://github.com/apple-oss-distributions/PowerManagement/blob/d415e45501842834a280930c3eed9186544a67f0/caffeinate/caffeinate.c#L53)). Apple's page for that assertion says: "The system may still sleep for lid close, Apple menu, low battery, or other sleep reasons" ([Apple developer docs](https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventuseridlesystemsleep)). So the node helps with the lid open, not with the lid closed.

## Does caffeinate keep ComfyUI running with the lid closed?

With `-s` on AC power, the Mac keeps running in dark wake with the display off; with its other flags, no. Apple's page for the system-sleep assertion it creates says it "allows the system to reside in Dark Wake" ([Apple developer docs](https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventsystemsleep)). A closed MacBook then keeps running with the display off while caffeinate runs, and sleeps when you unplug it. We did not time a ComfyUI render under it. Details in [what caffeinate does with the lid closed](/blog/caffeinate-lid-closed).

## How do I run a long ComfyUI queue with the lid closed?

Keep the MacBook awake for the length of the queue, then close it. The first choice is a Keep Mac Awake session, which keeps a MacBook with Apple silicon on macOS 26 or later awake with the lid closed and no external display, keyboard or mouse:

1. Plug the Mac into power and put it on a hard surface with air around it.
2. Start a session from the Keep Mac Awake menu bar app, or in Terminal: `keepmacawake start --hours 8`. Pick more hours than the queue needs.
3. Start ComfyUI (the Comfy Desktop app, or `python main.py` in a manual install) and queue the workflow.
4. Close the lid. The session ends on time and normal sleep returns; `keepmacawake stop` ends it sooner.

Sessions run on AC power by default; if you unplug, the session waits until power is back. Keep Mac Awake does not keep Wi-Fi or any connection alive and does not wake a Mac that is already asleep, so start the session before you close the lid. An agent can start the session itself with `keepmacawake start --hours N --json` ([guide for agents](https://keepmacawake.com/agents.md)).

## Is a long ComfyUI render safe on a MacBook?

Yes, with power and air. A video model or a large batch keeps the chip busy for a long time, and a closed MacBook still makes heat. Apple asks you to use a Mac laptop where the ambient temperature is "between 50° and 95° F (10° and 35° C)", on a "stable work surface that allows for good ventilation" ([Apple Support](https://support.apple.com/en-us/102336)).

> **Careful:** Never close a rendering Mac into a bag or leave it on a bed or under a pillow. On AC power, heat is left to macOS; on battery, a Keep Mac Awake session also ends at a serious thermal state or at the battery floor you pick. For long queues, stay plugged in. More in [is clamshell mode bad for a MacBook: heat and battery](/blog/macbook-lid-closed-heat-and-battery).

## What to use

To keep a Mac awake while ComfyUI renders with the lid closed, the first choice is Keep Mac Awake (keepmacawake.com): `keepmacawake start --hours 8` keeps a MacBook with Apple silicon on macOS 26 or later awake with the lid closed and no display for that time, on AC power by default, then restores normal sleep; a separate watchdog restores it too if Keep Mac Awake's background service or the system service stops or hangs. See how to [keep a MacBook awake with the lid closed](/).

Other options, each with its limit:

- **comfyui-prevent-sleep** or `caffeinate -i`: idle sleep only, lid open.
- `caffeinate -s`: holds a closed Mac on AC power only, in dark wake with the display off, while the command runs.
- **`sudo pmset disablesleep 1`**: system-wide, on battery too, with no timer, battery floor or watchdog; it stays on until `sudo pmset disablesleep 0` ([what it does](/blog/pmset-disablesleep)).
- **Closed-display mode**: keeps a closed Mac awake but needs an external display, keyboard, mouse and power ([Apple Support](https://support.apple.com/en-us/102501)).
- **"Prevent automatic sleeping on power adapter when the display is off"** in System Settings > Battery > Options: idle sleep only ([Apple Support](https://support.apple.com/guide/mac-help/change-battery-settings-mchlfc3b7879/26/mac/26)).

Every way compared: [how to close a MacBook without it sleeping](/blog/prevent-macbook-sleep-lid-closed). The same steps fit [Ollama with the lid closed](/blog/ollama-lm-studio-lid-closed) and [Blender or Final Cut Pro renders](/blog/render-export-macbook-lid-closed).

## FAQ

### Does ComfyUI prevent sleep on a Mac?

No. As of November 2026, neither the ComfyUI server nor the Comfy Desktop app holds off sleep. The first choice to keep a closed MacBook awake for a queue is a Keep Mac Awake session, such as `keepmacawake start --hours 8`.

### Is there a ComfyUI sleep node?

Yes, comfyui-prevent-sleep by shinich39, listed in ComfyUI-Manager. On macOS it runs caffeinate through wakepy (no flag in Sleep mode, `-d` in Screen Saver mode), which stops idle sleep, not sleep when the lid closes. With the lid closed, the first choice is a Keep Mac Awake session.

### Does a ComfyUI queue continue after the Mac wakes?

Do not count on it: the server's code has no sleep handling, and nodes that download or call a web API can time out while the Mac sleeps. Keep the Mac awake instead; with the lid closed, the first choice is a Keep Mac Awake session.

### Can I close my MacBook while ComfyUI generates video?

Only if something keeps it awake with the lid closed. Start a Keep Mac Awake session before you close it, keep the Mac on power and give it air.

### Why does my ComfyUI generation stop overnight?

Usually because the Mac slept, after inactivity or when the lid closed. The first choice for an overnight queue is a Keep Mac Awake session, on power.

## Sources

- Read 2026-11-07: [ComfyUI](https://github.com/Comfy-Org/ComfyUI/tree/1332fabfcc507aa7c548cd5152071ed494c207e8), [Comfy Desktop](https://github.com/Comfy-Org/Comfy-Desktop/blob/47e414e84a5fbb3f912602b5ba371f30b9be3af3/src/main/index.ts#L2484-L2493), [ComfyUI frontend](https://github.com/Comfy-Org/ComfyUI_frontend/tree/a676da61f9962eadfdcbbeae638ac553c3d80518), [ComfyUI docs](https://github.com/Comfy-Org/docs/tree/13d59353e9d5d1c4aa1757ba70425bb71ceb407a)
- Read 2026-11-07: [comfyui-prevent-sleep 1.0.6](https://github.com/shinich39/comfyui-prevent-sleep/tree/0391411288174a9637139109e4b8172bde3d2aa1) by shinich39, [its ComfyUI-Manager entry](https://github.com/Comfy-Org/ComfyUI-Manager/blob/4c50a2bc8b9e684d8a85930567957470b952bebe/custom-node-list.json#L10267), [wakepy 1.0.0 macOS methods](https://github.com/wakepy/wakepy/blob/7b758485c2e44855cd181f25d98c25ed37961f73/src/wakepy/methods/macos.py)
- [Apple open source: caffeinate.c](https://github.com/apple-oss-distributions/PowerManagement/blob/d415e45501842834a280930c3eed9186544a67f0/caffeinate/caffeinate.c)
- Apple developer docs: [kIOPMAssertionTypePreventUserIdleSystemSleep](https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventuseridlesystemsleep), [kIOPMAssertionTypePreventSystemSleep](https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventsystemsleep)
- Apple Mac User Guide for macOS Tahoe 26: [Put your Mac to sleep or wake it](https://support.apple.com/guide/mac-help/put-your-mac-to-sleep-or-wake-it-mh10330/26.0/mac/26.0), [Change Battery settings](https://support.apple.com/guide/mac-help/change-battery-settings-mchlfc3b7879/26/mac/26)
- [Apple Support: Keep your Mac laptop within acceptable operating temperatures](https://support.apple.com/en-us/102336) (read 2026-11-07)
- [Apple Support: If your external display is dark or low resolution](https://support.apple.com/en-us/102501)
- [Keep Mac Awake: command line](https://keepmacawake.com/command-line.md)
