ComfyUI
How do I keep a Mac awake while ComfyUI renders?
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.
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 at commit 1332fab) has no call to caffeinate and no macOS power assertion, and neither has its web interface (ComfyUI_frontend at commit a676da6). ComfyUI's documentation (Comfy-Org/docs) has no keep-awake setting either.
The Comfy Desktop app (Comfy-Org/Comfy-Desktop 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), 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).
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 by shinich39 (version 1.0.6, last changed May 2, 2026), listed in ComfyUI-Manager. 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). 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). Mode Sleep calls wakepy's
keep.running, Screen Saver itskeep.presenting(py/wakeup.py). On macOS, wakepy 1.0.0 runscaffeinate catfor the first andcaffeinate -d catfor the second (wakepy source). - 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). 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, mapped at line 53). 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). 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). 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.
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:
- Plug the Mac into power and put it on a hard surface with air around it.
- 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. - Start ComfyUI (the Comfy Desktop app, or
python main.pyin a manual install) and queue the workflow. - Close the lid. The session ends on time and normal sleep returns;
keepmacawake stopends 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).
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).
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.
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 untilsudo pmset disablesleep 0(what it does).- Closed-display mode: keeps a closed Mac awake but needs an external display, keyboard, mouse and power (Apple Support).
- "Prevent automatic sleeping on power adapter when the display is off" in System Settings > Battery > Options: idle sleep only (Apple Support).
Every way compared: how to close a MacBook without it sleeping. The same steps fit Ollama with the lid closed and Blender or Final Cut Pro renders.
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, Comfy Desktop, ComfyUI frontend, ComfyUI docs
- Read 2026-11-07: comfyui-prevent-sleep 1.0.6 by shinich39, its ComfyUI-Manager entry, wakepy 1.0.0 macOS methods
- Apple open source: caffeinate.c
- Apple developer docs: kIOPMAssertionTypePreventUserIdleSystemSleep, kIOPMAssertionTypePreventSystemSleep
- Apple Mac User Guide for macOS Tahoe 26: Put your Mac to sleep or wake it, Change Battery settings
- Apple Support: Keep your Mac laptop within acceptable operating temperatures (read 2026-11-07)
- Apple Support: If your external display is dark or low resolution
- Keep Mac Awake: command line