How to Use OpenAI Codex CLI From Your Phone

Run OpenAI's Codex CLI (the ChatGPT coding agent) on your own machine and drive it from an iPhone or Android phone over SSH — with approval notifications that actually reach you.

Updated

Short version: OpenAI's Codex CLI is the terminal coding agent you can use with your ChatGPT plan. Like Claude Code, it runs on a real computer, not on the phone. Install it on a machine you control, reach that machine over SSH, and keep the session alive on the server. Then turn on Codex's notifications so approval requests reach your pocket.

Why "Codex on your phone" usually means SSH

There are a few things called Codex. The cloud agent in ChatGPT works in OpenAI's sandbox. Codex CLI works on your machine, with your repos, your toolchain and your secrets. It's the one most developers want to keep driving from a phone.

Codex CLI has an experimental codex remote-control server mode, but there is no generally available phone client for it. Today the dependable path is the same one sysadmins have used for decades: SSH into the machine and use the real terminal UI.

Step 1: Install Codex CLI on the machine

On the Mac, Linux server or VPS that will do the work:

npm install -g @openai/codex
codex

The first run asks you to sign in. Choose Sign in with ChatGPT to use your plan, or use an API key. On a headless server where no browser can open, use the device-code flow (codex login --device-auth), or sign in on a computer that has a browser and copy ~/.codex/auth.json to the server.

Step 2: Make the machine reachable from your phone

  • Put the machine and your phone on Tailscale (or another private network). Don't expose port 22 to the internet.
  • Enable SSH: Remote Login in macOS Sharing settings, or openssh-server on Linux.
  • Use key-based authentication.

Step 3: Keep the session alive

A phone connection will drop. Codex must keep running when it does.

With HQSSH (recommended), install the daemon once:

$ curl -fsSL https://hqssh.com/install | sh

Then open your project in the app and tap LAUNCH CODEX. The session lives on the server, and you can reattach from your phone, iPad or the hqssh attach desktop CLI.

With a generic SSH client, start Codex inside tmux new -s codex and reattach with tmux attach -t codex.

Step 4: Get notified when Codex needs approval

This is the step most guides skip. Codex can send desktop-style notifications through the terminal (the OSC 9 escape sequence) when it finishes a turn or wants approval, but it is off by default and there is no persistent config set for it. Enable it per launch:

codex -c tui.notifications=true -c tui.notification_condition=always

HQSSH's LAUNCH CODEX button adds these flags for you. It reads the OSC 9 message, so the phone notification says what Codex wants (for example, "Approval requested") instead of a bare ping. With the daemon's ntfy webhook configured, the alert reaches you even with the app closed:

# ~/.hqssh/daemon.yaml
events:
  webhook_url: "https://ntfy.sh/your-private-topic-name"

Step 5: Phone-friendly Codex habits

  • Resume instead of restarting. codex resume --last picks up the latest conversation in that directory. HQSSH ships it as a one-tap snippet.
  • Keep approvals on. --dangerously-bypass-approvals-and-sandbox exists, but when you're away from the keyboard, approvals are your safety net. Answering them from a notification takes seconds.
  • Hand Codex a screenshot. HQSSH's image button uploads a photo to the server and pastes the path into the prompt, which is handy for "this UI looks wrong".
  • Preview what it built. If Codex starts a dev server, HQSSH's web preview forwards the port over SSH and opens it in your phone browser.

A note on scrollback

Codex renders its conversation inline in the normal terminal rather than full-screen, and clears the screen on every resize. On a phone, every keyboard show/hide is a resize. Many mobile terminals lose the whole transcript this way. HQSSH preserves scrollback through those clears, so you can scroll back through what Codex did while you were away.

Frequently asked questions

Is there an official Codex CLI mobile app?

+

Codex CLI ships an experimental `codex remote-control` server, but there is no generally available phone client for it. Over SSH, any mobile terminal can drive the real Codex TUI today.

Can I use my ChatGPT plan with Codex CLI over SSH?

+

Yes. Codex CLI signs in with your ChatGPT account (or an API key) on the server. SSH only carries the terminal, so the sign-in on the server is what counts.

How do I get notified when Codex needs approval?

+

Start Codex with `-c tui.notifications=true -c tui.notification_condition=always`. Codex then sends OSC 9 notifications, which HQSSH shows as phone notifications with the message text, such as "Approval requested". HQSSH's launch button adds these flags for you.

Keep reading