Use Codex CLI, OpenCode and Gemini CLI from your phone
On this page
Codex CLI remote control: what OpenAI offersOpenCode remote control: web and server modeGemini CLI remote control: none, and a smaller audienceThe route that works for all three: tmux, SSH and TailscaleLog in once on the headless machinePhone pain: Shift+Enter and approvalsHow Codeman handles itTo use Codex CLI, OpenCode or Gemini CLI from your phone, run the CLI inside tmux on a machine that stays on and connect to it from the phone over SSH or mosh, with Tailscale making the machine reachable from anywhere. As of October 2026 that is the one route that works for all three. Only OpenAI has an official phone route, and it is not a terminal: the ChatGPT mobile app controls Codex through a Mac or Windows PC running the ChatGPT desktop app. OpenCode ships a web UI a phone browser can open, and Gemini CLI has no remote mode.
Codex CLI remote control: what OpenAI offers
Codex on mobile lets you start tasks, follow them, approve requested commands and review diffs in the ChatGPT app. The remote connections docs list the requirements:
- Codex access on your ChatGPT account and workspace, and the latest ChatGPT app on iOS or Android.
- A host running the latest ChatGPT desktop app on macOS or Windows, awake, online and signed in to the same account and workspace. In OpenAI's words: "Mobile setup starts from the app; you can't set it up from the Codex CLI or IDE extension."
- On a ChatGPT workspace, an admin may first have to enable Remote Control access.
Setup starts on the host under Settings > Connections > Control this Mac or PC, and the phone scans a QR code. The desktop app can also open projects on an SSH host that has codex installed and logged in, so a Linux devbox can do the work, but the Mac or PC stays in the middle and must stay awake.
The demand is real: #10450 "Remote Development in Codex Desktop App" (876 reactions) and #9224 "Codex Remote Control" (544) are the second- and seventh-most-reacted issues in the Codex repo, both closed as completed on May 14, 2026. Pairing the phone with a headless Linux host directly, #23200, is still an open request. The CLI does ship an experimental codex remote-control command:
codex remote-control start # app-server daemon with remote control enabled
codex remote-control pair # print a short-lived manual pairing code
OpenAI's command reference says managed remote-control clients and SSH remote workflows use these commands, and users in #23200 report pairing a Linux server with the phone this way, but the mobile setup docs do not describe that flow.
If Codex mobile is not connecting, OpenAI's troubleshooting checks are: the desktop app is running with Allow other devices to connect on, both devices use the same account and workspace, and the host has not slept or lost its network. A connection not used since June 8, 2026 needs both apps updated and the devices paired again.
OpenCode remote control: web and server mode
OpenCode has no mobile app (anomalyco/opencode#10288, 103 reactions, is open), but it runs as a server. opencode web serves a browser UI, opencode serve a headless API on port 4096, and opencode attach <url> connects a terminal TUI to either. Both bind 127.0.0.1 by default, and "If OPENCODE_SERVER_PASSWORD is not set, the server will be unsecured." To open the web UI on a phone without exposing it to your LAN, keep the loopback bind, set a password and publish the port to your tailnet only:
export OPENCODE_SERVER_PASSWORD='long-random-string' # username: opencode
opencode web --port 4096 # leave it running, for example inside tmux
tailscale serve --bg 4096 # in a second shell: HTTPS, tailnet only
The docs do not describe a phone layout for the web UI.
Gemini CLI remote control: none, and a smaller audience
Gemini CLI has no remote or mobile mode. A proposal for one (google-gemini/gemini-cli#20782) was closed in May 2026 with a note that the team had no immediate plans for it. Since June 18, 2026, Gemini CLI also no longer serves Google AI Pro, AI Ultra and free individual accounts; it keeps working with Gemini Code Assist Standard or Enterprise licenses and paid API keys (Google's announcement).
Individual users were moved to Antigravity CLI (agy), which does have an official Remote Control: agy --remote-control (or /remote-control inside a session) for one session, or agy remote-control start for a background daemon, a systemd user service on Linux. You drive it from a web dashboard signed in with the same Google account, which can be installed to the phone's home screen for push notifications. The host must stay on, awake and online, and settings cannot be changed remotely.
The route that works for all three: tmux, SSH and Tailscale
tmux keeps the CLI running on the server, independent of any connection:
tmux new -s agents # then start codex, opencode, gemini or agy inside it
# Ctrl-b d detaches; the CLI keeps running
For the phone, mosh.org lists Termux (from F-Droid) and JuiceSSH on Android and Blink Shell on iOS. In Termux:
pkg install openssh mosh
mosh you@box -- tmux attach -t agents # or: ssh -t you@box tmux attach -t agents
That is also the practical answer to "codex cli on termux": OpenAI's install docs cover macOS, Linux and Windows, not Android, so let Termux be the client.
- Reachability. Tailscale connects phone and server across NAT "without requiring port forwarding".
tailscale set --sshturns on Tailscale SSH on Linux (or macOS with the open-sourcetailscaled), and your tailnet policy then decides who may log in. - Typing lag and drops. mosh gives "an instant response to typing, deleting, and line editing", roams between networks and survives sleep. It needs UDP ports 60000 to 61000 open between phone and server, and it syncs only the visible screen, so keep tmux on the server for scrollback.
The same setup for Claude Code, plus its own Remote Control, is in Use Claude Code from your phone.
Log in once on the headless machine
| CLI | Headless login |
|---|---|
| Codex | codex login --device-auth (beta), after device code login is enabled in your ChatGPT security settings, or by an admin for a workspace. Fallbacks: printenv OPENAI_API_KEY | codex login --with-api-key, or copy ~/.codex/auth.json from a machine with a browser (docs). |
| OpenCode | opencode auth login (or /connect in the TUI) with an API key; the ChatGPT and Claude subscription options open a browser. Keys go to ~/.local/share/opencode/auth.json (docs). |
| Gemini CLI | With a Code Assist license and GOOGLE_CLOUD_PROJECT set, NO_BROWSER=true gemini prints a sign-in URL and waits for the authorization code (source). With a paid key, export GEMINI_API_KEY. |
| Antigravity CLI | Over SSH it prints a URL; paste the code the browser shows back into the terminal. If the Linux keyring is locked, run export $(dbus-launch) first (install, troubleshooting). |
Phone pain: Shift+Enter and approvals
Newlines. "Some terminals don't send modifier keys with Enter by default," as OpenCode's keybind docs put it, and inside tmux a modified Enter also depends on tmux's extended-keys option, which is off by default. All three CLIs accept Ctrl+J as a newline: Codex (default keymap), OpenCode (input_newline) and Gemini CLI (shortcuts). Use your SSH app's Ctrl key.
Approvals. Pick the permission mode before you leave; OpenAI suggests --sandbox workspace-write --ask-for-approval on-request for low-friction local work. Then have the CLI tell you when it stops: Codex runs PermissionRequest hooks "when Codex is about to ask for approval", OpenCode plugins receive permission.asked and session.idle events, and Gemini CLI's Notification hook fires on tool-permission alerts. For Codex, ~/.codex/hooks.json can push to ntfy:
{
"hooks": {
"PermissionRequest": [
{ "hooks": [ { "type": "command",
"command": "curl -s -o /dev/null -d 'Codex needs approval' ntfy.sh/your-long-random-topic" } ] }
]
}
}
Codex runs a new hook only after you review and trust it in /hooks. An ntfy topic "is essentially a password", so pick one nobody can guess.
How Codeman handles it
Codeman is a self-hosted version of the tmux route: it runs Codex, OpenCode, Gemini CLI, Antigravity and other agent CLIs in tmux sessions on your machine and streams the real terminals to a browser, phone included. Tailscale is the recommended way in (Remote Access); with a dashboard password set, a phone can also log in by scanning a single-use QR code from the desktop dashboard.
For these CLIs specifically:
- Typing. On touch devices, OpenCode and Gemini sessions paint keystrokes locally and send them on Enter. Codex sessions use predictive echo instead, because Codex's composer reacts to every keystroke (Input And Voice).
- Multiline prompts. The key bar's Compose key opens an editor and sends the text as one paste followed by Enter, so line breaks need no Shift+Enter. Codex sessions also get
⇧←and⇧→for its queued-message editing. - Status. Codex, OpenCode and Gemini sessions get screen-checked working and idle detection on tabs and the phone home screen. A pending OpenCode or Gemini permission prompt shows as idle.
- Logins. Codeman does not manage CLI logins; log each CLI in once as above.
What does not work for them: Codeman's "Waiting for input" and "Permission required" pushes, their Approve and Deny buttons, the Approvals Inbox and the answer strips on the phone home screen all depend on Claude Code hooks (or DeepSeek Harness's own reports). Codex, OpenCode and Gemini sessions send no push when they wait for you or finish a turn, and usage-limit auto-resume is Claude-only. Codeman launches the stock CLI, so the CLI hooks above still run. In a Codex session, scrolling moves local scrollback, not Codex's transcript. The full matrix is in Agent CLIs, the phone UI in Mobile Guide.