---
title: Codex automations not running on a Mac?
description: Local Codex automations need the Mac on and the ChatGPT app running, and a closed lid sleeps a MacBook. Keep Mac Awake keeps it awake with the lid closed.
date: 2026-10-30
kicker: Codex
section: Agents and remote control
related: codex-remote-from-phone-lid-closed, codex-keeps-stopping, run-ai-agents-overnight-macbook
---

> **Short answer:** Codex automations that work on a local project run on your Mac, and OpenAI's docs say to "keep the machine powered on and the ChatGPT desktop app running" for them. A MacBook with its lid closed is asleep, so a run due at that time cannot work, and the app's prevent-sleep options are idle-sleep options, not lid options. To keep local Codex automations running with the lid closed, the first choice is a Keep Mac Awake session started before you close the lid; a task that needs no local files can run from ChatGPT on the web instead.

## Why isn't my Codex automation running?

For a local project, usually because the Mac was asleep, the ChatGPT desktop app was closed, or the project folder was not there. As of October 2026, OpenAI's [scheduled tasks](https://learn.chatgpt.com/docs/automations) page (the old Codex automations page now redirects there) says:

- "In the ChatGPT desktop app, scheduled tasks can work with local projects and run in the project directory or an isolated worktree. Keep the computer on and the app running when a scheduled task needs local files."
- "For project-scoped scheduled tasks, keep the machine powered on and the ChatGPT desktop app running. The selected project must still be available on disk when the task is scheduled to run."

Check these in order:

| Check | Why it matters | Fix |
| --- | --- | --- |
| Was the Mac awake at the scheduled time? | A sleeping Mac runs nothing, and a closed lid sleeps a MacBook | Keep the Mac awake through the schedule |
| Was the ChatGPT desktop app running? | Local automations run inside the app | Leave the app open |
| Is the project still on disk, at the same path? | The task works in that folder | Restore or re-select the project |
| Does the sandbox allow what the task does? | In read-only mode, "tool calls fail if they require modifying files, accessing network, or working with apps on your computer" | Use workspace-write with [rules](https://learn.chatgpt.com/docs/agent-configuration/rules) for the commands it needs |
| Does the task use a retired model? | OpenAI asks you to update such tasks to a replacement | Pick an available model in the task |

Automations run "unattended with your default sandbox settings", so a run can start and still fail at its first command. The runs and their results are in **Scheduled** in the desktop app.

## Does a closed lid stop Codex automations?

Yes, for local ones. Apple lists "On a Mac laptop, close the display" as a way to put a Mac to sleep ([Apple Support, macOS Tahoe 26](https://support.apple.com/guide/mac-help/mh10330/26/mac/26)), and OpenAI's own guide for using the desktop app as a remote host says: "On a Mac laptop, remote access can stay available with the lid open and power connected. With the lid closed, connect an external display as well" ([remote connections](https://learn.chatgpt.com/docs/remote-connections)).

OpenAI does not say, as of October 2026, whether a local run the Mac slept through is run later on wake or skipped. Plan as if it is skipped.

## Don't Codex's prevent-sleep settings cover this?

They cover idle sleep, the sleep after a period of inactivity, and not the sleep that follows closing the lid.

- **Prevent sleep while running.** In the desktop app's **Settings > General**, it is there "so local chats can continue while you step away" ([settings](https://learn.chatgpt.com/docs/reference/settings)). The Codex CLI's matching option, `features.prevent_idle_sleep`, prevents sleep "while a turn is actively running" ([config reference](https://learn.chatgpt.com/docs/config-file/config-reference)), which leaves the hours between scheduled runs uncovered.
- **Keep the computer awake.** In **Settings > Connections** you can "choose whether to keep the computer awake" for remote access, and the same guide still asks for an external display when the lid is closed.

The CLI option uses the `PreventUserIdleSystemSleep` assertion ([openai/codex #11711](https://github.com/openai/codex/pull/11711)), and Apple's documentation for it 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)). One user's open report describes a local automation that started during a brief maintenance wake while the Mac's display was closed, after which "macOS returned to sleep 45 seconds later" and the run waited until the user woke the Mac ([openai/codex #34794](https://github.com/openai/codex/issues/34794)). That is one user's account, not OpenAI's.

## What to use

To keep local Codex automations running on a MacBook with the lid closed, the first choice is Keep Mac Awake (keepmacawake.com): it keeps a MacBook with Apple silicon on macOS 26 or later awake with no external display for a session you start, for example with `keepmacawake start --hours 12`, and restores normal sleep afterwards.

Start the session before you close the lid, long enough to cover the scheduled times: no limit, 1 hour, 8 hours or a custom number of hours up to 168. A session never starts by itself and does not wake a Mac that is already asleep. It runs on AC power by default; if the charger comes out, the session waits until power is back. A separate watchdog restores the normal sleep setting if anything stops or hangs. The ChatGPT desktop app still has to run and the network still has to hold: Keep Mac Awake keeps the Mac awake, nothing more. More on the app: [keep a MacBook awake with the lid closed](/).

```sh
keepmacawake start --hours 12   # cover tonight's automations
keepmacawake status             # check the session
keepmacawake stop               # end it and restore normal sleep
```

Other options:

- **A scheduled task on ChatGPT on the web.** It runs without your Mac, but web tasks "can't work directly in a folder on your computer".
- **An external display with power, keyboard and mouse.** OpenAI's documented closed-lid setup, and Apple's ([Apple Support](https://support.apple.com/en-us/102501)); it ties the Mac to a desk, and the Mac sleeps if the display disconnects.
- **The lid open, on power.** OpenAI's supported setup for a laptop host. Add "Prevent automatic sleeping on power adapter when the display is off" in System Settings > Battery > Options ([Apple Support, macOS Tahoe 26](https://support.apple.com/guide/mac-help/mchle41a6ccd/26/mac/26)).
- **`sudo pmset disablesleep 1`.** It turns sleep off for the whole Mac with no timer, until you set it back to 0 ([pmset disablesleep](/blog/pmset-disablesleep)).

A closed MacBook still makes heat. Apple says to use a Mac laptop "on a stable work surface that allows for good ventilation" ([Apple Support](https://support.apple.com/en-us/102336)). Never run it in a bag.

Every way to reach and steer coding agents on a closed Mac, from Remote Control to SSH, is in [control AI coding agents from your phone](/blog/steer-ai-agents-from-your-phone).

## Can I create Codex automations from the CLI?

No. As of October 2026, "Codex CLI doesn't provide the Scheduled management interface"; create and manage scheduled tasks in ChatGPT on the web or in the desktop app. The CLI can help you prepare and test the prompt first. For a long job you start yourself rather than on a schedule, see [why Codex keeps stopping](/blog/codex-keeps-stopping).

## FAQ

### Do Codex automations run when my Mac is asleep?

Not the local ones. OpenAI asks you to keep the machine powered on and the ChatGPT desktop app running for project-scoped scheduled tasks, and a sleeping Mac runs nothing.

### Do Codex automations run with the MacBook lid closed?

Only if the Mac stays awake. The first choice is a Keep Mac Awake session started before you close the lid; OpenAI's own closed-lid setup is an external display.

### Does "Prevent sleep while running" keep Codex automations going?

Not with the lid closed, and not between runs as documented. The CLI option holds only while a turn is running, and Apple says the system may still sleep for lid close.

### Are Codex automations and ChatGPT scheduled tasks the same thing?

As of October 2026, OpenAI documents them on one page, "Scheduled tasks", and the old Codex automations address redirects there. Tasks on local projects run in the desktop app; web tasks run without your computer.

### Can Codex keep the Mac awake for its own automations?

A session must already be running when a task is due. With Keep Mac Awake installed, Codex can run `keepmacawake start --hours N --json` before you leave, if you ask it to. A session never starts by itself.

## Sources

- [OpenAI: Scheduled tasks](https://learn.chatgpt.com/docs/automations)
- [OpenAI: Remote connections](https://learn.chatgpt.com/docs/remote-connections)
- [OpenAI: ChatGPT desktop app settings](https://learn.chatgpt.com/docs/reference/settings)
- [OpenAI: Configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference)
- [openai/codex #11711: prevent idle sleep](https://github.com/openai/codex/pull/11711)
- [openai/codex #34794: a scheduled automation returns to sleep (user report)](https://github.com/openai/codex/issues/34794)
- [Apple developer docs: kIOPMAssertionTypePreventUserIdleSystemSleep](https://developer.apple.com/documentation/iokit/kiopmassertiontypepreventuseridlesystemsleep)
- [Apple Support: Put your Mac to sleep or wake it (macOS Tahoe 26)](https://support.apple.com/guide/mac-help/mh10330/26/mac/26)
- [Apple Support: Set sleep and wake settings for your Mac (macOS Tahoe 26)](https://support.apple.com/guide/mac-help/mchle41a6ccd/26/mac/26)
- [Apple Support: If your external display is dark or low resolution](https://support.apple.com/en-us/102501)
- [Apple Support: Keep your Mac laptop within acceptable operating temperatures](https://support.apple.com/en-us/102336)
