Leaving the Codex CLI running on your Mac and checking on it from somewhere else

You start a task in the Codex CLI, it settles into a long run, and you have to leave. Ten minutes later the question arrives: did it finish, did it fail, or is it sitting there waiting for someone to approve a command? Searching for "codex cli remote" turns up two different answers that are easy to confuse. One is OpenAI's Remote feature, which is about the ChatGPT apps. The other is the older, plainer question of how to reach a terminal session on your own Mac from somewhere else. This guide separates them and shows what each one can and cannot do.

What OpenAI's Remote feature actually is

OpenAI documents Remote as a way to start, guide and review coding tasks from your phone. The shape of it is specific, and the details decide whether it fits your setup.

The host is the ChatGPT desktop app. The documentation states that Remote supports hosts running the ChatGPT desktop app on macOS and Windows, and that you control the host from ChatGPT on iOS or Android. Setup starts on the computer: Settings, then Connections, then "Control this Mac or PC", then Set up or Add. The desktop app shows a QR code, you scan it with your phone, sign in to the same account and workspace, and the host appears under Remote in the mobile app.

From the phone you can then start new chats in projects on the host, send follow-up instructions, approve commands and other actions, and review outputs, diffs, test results and terminal output. Connections run through what the documentation calls a secure relay layer that keeps trusted machines reachable without exposing them directly to the public internet.

Two constraints matter for anyone whose daily driver is the CLI.

Setup cannot start from the CLI. The documentation is explicit: mobile setup starts from the app, and you cannot set it up from the Codex CLI or IDE extension.

The host must stay awake and online. The docs tell you to keep the computer awake and online, and the desktop app has a "Keep this Mac awake" setting that prevents sleep when the computer is plugged in and remote access is enabled. If the machine sleeps, loses the network or the app closes, remote access stops until it is available again. On a Mac laptop, the docs note that remote access can stay available with the lid open and power connected, and that with the lid closed you also need an external display. Choosing Sleep still stops remote access.

There is also an SSH direction. In the desktop app, Settings, Connections, SSH lets you add a remote host from your ~/.ssh/config, run chats against that machine's filesystem and shell, and hand a chat between your local computer and a remote host. That is about where the work runs, not about reaching your Mac from a phone.

Why Remote does not pick up the session already running in your terminal

This is the gap that sends people searching in the first place. A Codex CLI session is a process in a terminal on your Mac, with its own conversation history, its own working directory and its own pending approval prompts. Remote gives your phone a way to talk to the ChatGPT desktop app on that machine. It does not reach into a terminal window and take over a running CLI session.

So if the run you care about was started with codex in a terminal, checking on it from outside means reaching that terminal, not reaching the app. That is an ordinary remote access problem, and it has ordinary solutions.

Route one: SSH into your own Mac, with tmux holding the session

This is the route that works regardless of which coding agent you use, and it is worth setting up once.

On the Mac. Open System Settings, go to General, then Sharing, and turn on Remote Login. Apple's guide to allowing a remote computer to access your Mac covers the details, including the ssh username@hostname form and where to find the exact command for your machine. Set "Allow access for" to your own account rather than all users.

Hold the session in tmux. Start your work as tmux new -s codex, then run codex inside it. The session belongs to tmux, not to the terminal window, so it survives you closing the lid, losing Wi-Fi or connecting from a different device. From anywhere else, tmux attach -t codex puts you back in front of the same running agent, mid-task, with its scrollback intact.

Keep the Mac awake. A sleeping Mac accepts nothing. The pmset manual documents sleep 0 to disable the system sleep timer and ttyskeepawake, which prevents idle sleep while a tty such as a remote login session is active. For a single long job, caffeinate -s prevents system sleep for as long as that command runs, which is tidier than changing a system-wide setting and forgetting about it.

Reach the Mac from outside. On mobile data your router will not let the connection through. A private network between your own devices is the usual answer, and Tailscale is the one most people name; its pricing page lists a Personal plan at $0 with unlimited user devices and up to 6 users. OpenAI's own guidance points the same way: do not expose app-server transports on a shared or public network, and use a VPN or mesh networking tool if you need to reach a remote machine from outside your current network.

On the phone. Any SSH client will do. The App Store listings for Termius, Blink Shell and Secure ShellFish all describe SSH support; Termius and Blink Shell also mention Mosh, whose site describes roaming and intermittent connectivity, and Secure ShellFish mentions built-in tmux support for reattaching sessions.

Route two: run the task so it does not need you

Half of remote checking exists because the agent stopped to ask a question. Reduce the questions and you reduce the need to connect.

The Codex CLI has a non-interactive mode, documented as codex exec, for running a task without the interactive loop, and OpenAI describes composing it with scripts and pipelines. A run started that way can write its output to a file you read later instead of waiting for a person.

Permissions are the other half. In the interactive CLI, /permissions chooses what Codex is allowed to do, and the CLI also ships a sandbox subcommand for running commands inside a Codex-provided sandbox. Deciding this before you walk away is the difference between coming back to finished work and coming back to a prompt that has been waiting for an hour.

When a session does end while you are away, the CLI can pick it back up: codex resume reopens a previous interactive session, with --last to continue the most recent one, and codex fork branches from an earlier session. Between them, an interrupted evening does not have to start over.

Route three: a window that shows the terminal, from the phone

There is a middle option between streaming a whole desktop and typing raw SSH on a phone keyboard.

Screen sharing does work. macOS Screen Sharing plus a VNC app on the phone shows you the Mac desktop, terminal window included. But an agent's output is text, and streaming a desktop to read text is the expensive way to do it: tiny characters, constant scrolling, and a stream that struggles on a weak mobile signal.

The lighter option is a tool that treats the terminal as text rather than pixels. Some file managers with a built-in terminal now pair with an iPhone and iPad companion that shows the Mac's terminal reflowed to the width of the phone, lets you type into it, and lists the folders you registered on the Mac so you can check what the agent changed. Connections go directly over the same Wi-Fi and switch to an encrypted relay when you are away from home. The iPhone and iPad page describes how that works, and the features page covers the folder side, including per-folder terminals and notifications when a job finishes or needs an answer.

What "checking on it" usually means

It helps to be precise about what you are trying to do from outside, because the four common cases want different tools.

Is it done? This is the cheapest question and the one most worth automating. A run that ends by posting to a chat service, or a Mac app that pushes a notification when a job finishes, means you never open a session just to find out that nothing has changed.

What did it print? Text, and only text. SSH, or a phone view of the terminal, answers this in a second on any connection.

It is waiting for an approval. You need to type back, not just read. Any of the three routes can do it, but the phone keyboard matters here, and so does whether the app gives you arrow keys, tab and escape without hunting through menus. The App Store listings for Termius and Secure ShellFish both make a point of their extra key bars for this reason.

What did it change? This one is about files, not the terminal. SFTP in an SSH client, the Files app integration Secure ShellFish describes, or a file view that sits beside the terminal all answer it. A screen sharing session is the weakest choice, because you can see a file on the shared desktop but cannot easily bring it back to the phone.

Matching the tool to the question is what stops remote checking from feeling like a chore.

Comparing the three routes

Route What you need Reaches a running CLI session Best for
OpenAI Remote ChatGPT desktop app on the Mac, ChatGPT mobile app, same account and workspace No, it works with the app's own chats Starting and approving work from the phone without touching a terminal
SSH and tmux Remote Login on, SSH client on the phone, tmux, a private network for outside access Yes, if the session was started in tmux Anyone comfortable in a terminal, any agent, any machine
Terminal companion app A Mac app that pairs with a phone app Yes, for sessions it runs Reading output and answering prompts without typing ssh on a phone

None of these removes the basic requirement. The Mac has to be awake, online and signed in for any of them to work.

Safety before you leave it running

An agent with permission to run commands, reachable from your phone, is a lot of capability left unattended. A few decisions cost nothing and prevent the bad evenings.

Work in a repository under version control, and commit before you walk away, so an unwanted change is one command from being undone. Decide permissions deliberately rather than approving everything so the run does not pause. Restrict Remote Login to your own account and use SSH keys instead of passwords. Keep the Mac off the public internet, reaching it through a private network instead of a forwarded port. And be careful with credentials on the machine: whatever the agent can run, it can run with the access that machine already has.

What to change first

Turn on Remote Login for your own account, start your next Codex CLI run inside a tmux session, and confirm from your phone that you can reattach to it before you actually need to. That single habit covers the common case, because the session keeps running whether or not anything is connected to it. If reading the output and the changed files from a phone is the part that annoys you, Atriens pairs a Mac window with an iPhone and iPad view of the same terminal and folders.

Frequently asked questions

Can OpenAI's Remote feature control a Codex CLI session that is already running?

No. Remote connects the ChatGPT mobile app to the ChatGPT desktop app on a Mac or Windows host, and its documentation says setup cannot start from the Codex CLI or the IDE extension. A session started with codex in a terminal is reached through SSH or a terminal companion app instead.

What happens to a Codex run when the Mac goes to sleep?

It stops making progress, and anything connected to it drops. Disable system sleep with pmset sleep 0, or run the job under caffeinate -s, which prevents system sleep while that command is running on power.

Does checking on a run from a phone need a VPN?

It needs some way through your home router. A private network such as Tailscale is the common answer, and OpenAI's own guidance recommends a VPN or mesh networking tool rather than exposing a remote machine directly to the internet.

How do you continue a Codex session that ended while you were away?

Use codex resume to reopen a previous interactive session, or codex resume --last for the most recent one. codex fork starts a new branch from an earlier session if you want to keep the original intact.

Is SSH or screen sharing better for watching an agent work?

SSH, for almost everything. Agent output is text, so SSH stays readable on a phone and survives a weak signal, while screen sharing streams a whole desktop to show the same characters. Screen sharing is still the answer when a graphical app is involved.

Back to all posts