Use Codex from your phone with the MacBook lid closed

By Matyas Rathonyi. Updated October 9, 2026. Guides

Codex in the ChatGPT phone app, SSH with tmux, and third-party mobile clients all reach a Codex session that runs on your Mac. A closed MacBook lid sleeps the Mac, and the phone loses the session until the lid opens. To keep it reachable lid-closed, keep the Mac awake: an external display, a desktop Mac, or Clamshell, a Mac menu bar app that needs no sudo and no monitor.

OfficialCodex in the ChatGPT phone app
DIYSSH and tmux over a VPN
Lid closedMac sleeps, phone loses it
FixKeep the Mac awake, or use Cloud

Clamshell for Mac keeps the Mac awake and online with the lid closed while armed, so your phone can keep reaching Codex. Free for 7 days, then $9.99 once.

Download free trial

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB. Or buy now, $9.99. On your phone? Send the Mac download link to yourself.

A phone sends Codex instructions to a MacBook. The lid closes, the Mac stays awake, and Codex keeps working. phone Codex still working
Your phone only steers. The Mac does the work.Every way of driving a local Codex session from a phone needs the Mac awake and online. Keep it awake with the lid closed and the session stays in reach.

OpenAI does ship a phone remote for Codex: the ChatGPT mobile app can control Codex chats on a paired Mac. Developers also use SSH and tmux, often over Tailscale, or open-source clients such as Happy. All of these send your instructions to a Codex session that runs on the Mac. None of them keeps the Mac awake when the lid closes. This guide covers the remote routes and the free and paid ways to keep a closed MacBook reachable. If you only need a long local run to finish, start with keep Codex running with the lid closed.

Can you control a local Codex session from your phone?

Yes. There is one official route and a few common do-it-yourself ones. They differ in setup and security. They all share one dependency: the Mac.

RouteHow it connectsLid closed, no monitor
Codex in the ChatGPT phone app Pair the phone with the ChatGPT desktop app by QR code. OpenAI uses a secure relay, so no port is opened on the Mac. Stops until the Mac wakes
codex remote-control (CLI) Marked experimental in the Codex CLI help. Starts a background app server with remote control; pair prints a short-lived pairing code. Stops, same host requirement
SSH and tmux macOS Remote Login, reached through Tailscale or another VPN, from an SSH app such as Termius or Blink. Freezes; tmux reattaches after wake
Third-party clients Open-source apps such as Happy, HAPI or Remodex run their own daemon on the Mac. Stops; some also check the lid
Codex Cloud Not your Mac: each task gets an OpenAI cloud workspace you can follow from the phone. Keeps going

The official route. On the Mac, open the ChatGPT desktop app and go to Settings > Connections > Control this Mac or PC, choose Set up or Add, and scan the QR code with your phone. In the ChatGPT app on iOS, open Codex, or Remote if your app still shows it. From the phone you can start or continue chats, approve commands, and review diffs and test results. OpenAI's docs say the Codex CLI and IDE extension cannot start this mobile setup, so you need the desktop app on the Mac.

The CLI route. Recent Codex CLI releases include codex remote-control, with start, stop and pair subcommands. Its own help text labels it experimental, and OpenAI's Remote connections page does not document it, so expect it to change.

What happens when the lid closes

Two chains from phone to relay to Mac. When the Mac sleeps, the link from the network to the Mac breaks and Codex stops. When the Mac is kept awake with the lid closed, both links carry traffic and Codex keeps working. Lid closes, Mac sleeps z Mac kept awake, lid closed
Phone, network, Mac: the last link is the one that breaks. Your phone still reaches OpenAI's relay or your VPN. The sleeping Mac is what stops answering, and Codex on it stops making progress.

Closing a MacBook lid starts lid sleep, which is separate from idle sleep. A busy Codex session does not block it, and caffeinate does not either, because it only holds off idle sleep. Once the Mac sleeps, every route in the table above loses its far end:

The desktop app's Keep this Mac awake setting does not close this gap. OpenAI describes it as preventing sleep when the computer is plugged in and remote access is enabled, which covers idle sleep with the lid open. Why Keep this Mac awake stops at a closed lid goes into the details.

A timeline. Codex progress and the phone link both stop at the moment the lid closes. The tmux session on the Mac still exists, frozen, until the lid opens. Codex turn Phone link tmux session lid closes z z frozen, not gone
Everything stops at the same moment. The work and the phone link stop at lid close. The tmux session survives in memory and picks up after the Mac wakes, but the hours in between are lost.

Ways to keep a local Codex session reachable

Use a Mac mini or another desktop Mac

No lid to close. Set it not to sleep in System Settings and use it as the Codex host for your phone. The best always-on answer if you have one or plan to buy one.

Connect an external display

OpenAI's documented setup for a closed laptop. Apple's closed-display mode also needs power and an external keyboard and mouse. Good at a desk, not on the move.

Send the task to Codex Cloud

OpenAI says each cloud task can keep working while your computer is asleep, and you can follow it from the phone. It cannot use files, tools or credentials that exist only on your Mac.

Leave the lid open on power

Free and supported by OpenAI's docs with Keep this Mac awake on. Fine on a desk at home, less so on a shared table or in a bag.

caffeinate

Does not help here. It blocks idle sleep only, so the Mac still sleeps at lid close. See why caffeinate does not work with the lid closed.

sudo pmset -a disablesleep 1

Works with the lid closed, but it is a global admin switch with no timer, active on battery too, and easy to forget. See what pmset disablesleep does and how to undo it.

Clamshell

A menu bar app that keeps an Apple Silicon MacBook awake with the lid closed only while armed, with the built-in display dark. No sudo, no monitor. It watches heat and disarms toward normal sleep at serious thermal pressure.

Decision chart. If the job does not need your Mac, use Codex Cloud. If it does and the lid stays open or a display is attached, the Codex Keep this Mac awake setting is enough. If the lid is closed with no monitor, use Clamshell. Needs files on your Mac? no yes Codex Cloud Lid closed, no monitor? no yes Keep this Mac awake Clamshell
Pick by where the work must run. Cloud tasks never needed your Mac awake. Lid open or display attached, OpenAI's own setting covers it. Lid closed with no monitor is the case that needs a lid-sleep tool.

Clamshell for Mac keeps a closed MacBook awake and online, so Codex stays reachable from your phone. Free for 7 days, then $9.99 once for one Mac.

Download free trial

Apple Silicon, macOS 14+. Notarized by Apple. 3.6 MB.

Set up Codex on your phone with the lid closed

Use an Apple Silicon MacBook on macOS 14 or later, on a ventilated surface, preferably on power. OpenAI's docs recommend keeping a remote host plugged in.

  1. Pair the phone. In the ChatGPT desktop app, go to Settings > Connections > Control this Mac or PC, choose Set up or Add, and scan the QR code with the ChatGPT app on your phone. Use the same account and workspace on both.
  2. Leave Keep this Mac awake on. It still covers idle sleep while the lid is open and the Mac is plugged in.
  3. Arm Clamshell. Disconnect external displays first: with one connected, Clamshell pauses instead of arming. Arm from the menu bar, or hold Option while you close the lid on a MacBook Air M2 (2022) or later or a 14-inch or 16-inch MacBook Pro (2021) or later.
  4. Check the armed state, then close the lid. Open the Clamshell menu and look for the armed row before the lid goes down. Then pick up the chat on your phone.

The SSH and tmux route

If you prefer a terminal on your phone, or use the Codex CLI only, this is the common setup. It does not involve OpenAI's relay, so you are responsible for access control.

  1. Turn on Remote Login. In System Settings, go to General > Sharing and turn on Remote Login. Apple suggests limiting it to specific users and turning it off when you no longer need it.
  2. Put the Mac and phone on a private network. Tailscale is a common choice. On macOS, Tailscale's own SSH server needs the open-source tailscaled variant, so with the App Store or standalone app, use plain Remote Login over the Tailscale address. Do not open SSH to the public internet.
  3. Start Codex inside tmux on the Mac.
    tmux new-session -A -s codex
    codex
  4. Attach from the phone. In an SSH app such as Termius or Blink, connect and reattach to the same session:
    ssh you@your-mac
    tmux attach -t codex
  5. Arm Clamshell before you close the lid. tmux keeps the session through a dropped connection, but only an awake Mac keeps Codex working and answering SSH.

Third-party clients can have their own lid logic. Happy issue #1817, open as of October 2026, reports that its daemon refuses to reconnect while the lid is closed with no external display, even on a Mac that is kept awake. Test your client with the lid closed before you rely on it overnight.

Check it from your phone

A connected indicator in the app is not proof that work is happening. Before a long run, spend two minutes on this.

  1. With the lid open, ask Codex to run this and approve it:
    for i in {1..12}; do
      date -u '+%H:%M:%S' >> lid-check.txt
      sleep 10
    done
  2. Confirm Clamshell is armed and close the lid.
  3. After two minutes, from your phone, ask Codex to show lid-check.txt and print the current time. Pass: twelve timestamps about ten seconds apart and a fresh reply. A gap or no reply means the Mac slept or the connection dropped.

What Clamshell does and does not do here

Keeps the closed Mac awake

On an Apple Silicon MacBook with macOS 14 or later, it keeps the Mac awake and on the network with the lid closed while armed, with the built-in display dark. Opening the lid locks the Mac.

Watches heat

Thermal safety is always on. At serious or critical macOS thermal pressure it disarms toward normal lid sleep and blocks arming until the Mac cools. It does not replace airflow, so keep the Mac out of a bag.

Restores normal sleep

Disarming, quitting or a safety stop returns the Mac to normal lid sleep. Nothing persists across a restart, and no admin rights, kernel extension or privileged helper are involved.

Does not manage Codex

It does not detect Codex, end when a task finishes, wake a Mac that is already asleep, repair a dropped connection or answer approval prompts.

From scripts, open "clamshell://arm" and open "clamshell://disarm" request arming and disarming, and Shortcuts gets Arm, Disarm, Toggle and Status actions. The Codex lid-closed guide has a codex exec wrapper that disarms when the job ends. If Codex uses computer use on the host, see computer use with the lid closed. Clamshell costs $9.99 once for one Mac after a 7-day free trial.

Frequently asked questions

Can I control a local Codex session from my phone?

Yes. OpenAI's Remote connections feature lets the ChatGPT mobile app on iOS or Android control Codex on a paired Mac or Windows PC that runs the ChatGPT desktop app. On iOS you open Codex, or Remote in older app versions. The work still runs on the computer, so it has to stay awake and online.

Does Codex Remote keep working when I close my MacBook lid?

Not by default. Closing the lid puts the Mac to sleep, and OpenAI's docs say remote access stops until the computer is available again. OpenAI says a Mac laptop host stays available with the lid open and power connected, and that with the lid closed you should connect an external display. Without a display, a lid-sleep tool such as Clamshell can keep the Mac awake.

Does SSH and tmux keep Codex running when the Mac sleeps?

No. tmux keeps the terminal session alive across a dropped SSH connection, but it cannot run anything while the Mac is asleep. The SSH connection from your phone stops responding, Codex stops making progress, and you can reattach to the same tmux session after the Mac wakes.

Does caffeinate keep a Mac reachable from my phone with the lid closed?

No. caffeinate prevents idle sleep only. Closing the lid triggers a separate sleep path that caffeinate does not block, so the Mac still sleeps and drops off the network.

Do I need my Mac awake to check Codex Cloud tasks from my phone?

No. Codex Cloud tasks run in OpenAI's cloud, and OpenAI says each task can keep working while your computer is asleep. You can follow them in the ChatGPT mobile app. Cloud tasks cannot use files, tools or credentials that exist only on your Mac.

Does Clamshell make a sleeping Mac reachable or detect Codex?

No. Clamshell keeps an Apple Silicon MacBook awake with the lid closed while it is armed, which keeps the Mac on the network. It cannot wake a Mac that is already asleep, repair a dropped connection, detect Codex or answer Codex approval prompts.

Related guides

Sources checked October 9, 2026: OpenAI's Remote connections, Codex on mobile and Codex Cloud docs, the openai/codex source and issue #34358, Happy issue #1817, Tailscale's Tailscale SSH docs, and Apple's Remote Login and closed-display guidance. Clamshell behavior is described from its app source and FAQ. No new hardware testing was done for this page. Clamshell is an independent app, not affiliated with or endorsed by OpenAI. Codex and ChatGPT are trademarks of their owner.