All guides

Notifications from Codex on a remote server over SSH

Updated 19 November 2026 · 5 min read

When the Codex CLI runs on a remote server, a notify-send or osascript hook fires on the server, where there is no desktop to show it. Two routes work. The first is a terminal escape sequence: Codex's built-in alert (OSC 9 or the bell) is written to the terminal, travels back over the SSH connection, and your local terminal shows it, but only while you're connected and the window is open. The second is a push over the network from the server to your phone, through ntfy, a webhook or Notifier for Codex, which keeps working when your laptop is shut.

01Route 1: let the alert travel over SSH

Codex's built-in notification isn't a desktop API call; it's a sequence of characters written to the terminal. Over SSH those characters go back to whatever terminal you're sitting at, which then decides what to do with them.

On the server, in ~/.codex/config.toml:

[tui]
notifications = true
notification_method = "osc9"

Setting osc9 explicitly matters here. In auto mode, Codex decides from the terminal it detects on the server side, which over SSH may not match the terminal on your desk. If your local terminal is Ghostty, iTerm2, Kitty, Warp or WezTerm, osc9 shows a desktop notification on your own computer. If it's something else, use bel and set your local terminal to make the bell visible or audible.

Limits:

  • You must be connected. Close the laptop or drop the connection and nothing arrives.
  • By default the alert only fires while the terminal is unfocused. If it never fires over SSH, try notification_condition = "always".
  • Inside tmux on the server, tmux must pass the sequence through. See the tmux guide.

02Route 2: push from the server to your phone

Anything that makes an HTTPS request from the server can reach your phone, whether or not your laptop is on. A Stop hook that posts to ntfy is the simplest:

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "curl -s -o /dev/null -d \"Codex finished on $(hostname)\" https://ntfy.sh/your-secret-topic",
            "timeout": 15
          }
        ]
      }
    ]
  }
}

Put it in ~/.codex/hooks.json on the server, start codex, and trust the hook in /hooks. The -o /dev/null matters: Codex treats text printed by a Stop hook as invalid output, and ntfy replies with a body. Add a PermissionRequest hook the same way for "needs approval". The ntfy guide has the full script and how to keep the topic private, and the chat webhooks guide does the same for Telegram, Slack and Discord.

These are one-way. You'll know Codex is waiting, then you connect and answer.

03Answering from the phone: Notifier for Codex

Notifier for Codex works on a server exactly as on a desktop, because it hooks into Codex, not the terminal. On the server:

  1. In the Notifier for Codex app, add a computer and choose Linux (or your server's system). It shows a 6-digit code.
  2. Paste the line it shows into your SSH session, for example:
curl -fsSL https://notifierforcodex.com/install.sh | sh -s 482913
  1. Run codex on the server as usual, ideally inside tmux.

You get "finished" pushes, approvals you can approve or reject, questions you can answer, and a box for the next instruction. The pairing goes through the network, so it works with the laptop shut. Notifier for Codex is independent and not affiliated with OpenAI.

How it decides whether to wait for you

codex-notifier only makes Codex wait for the phone when you seem to be away. On a Linux server with no desktop, it reads that from the terminal itself: how long since your last keypress in the session Codex runs in. So if you're typing over SSH, prompts appear in the terminal as usual; when you stop for 30 seconds, the next approval waits for your phone.

Where it can't read your idle time at all, it doesn't make Codex wait: the phone still gets the alert, and the prompt appears in the terminal at once. If you'd rather it hold anyway, run codex-notifier config set hold_without_presence on, knowing that typing can't then cut the wait short. codex-notifier doctor shows what it can detect.

Keep the session alive

If your SSH connection drops, a plain codex session dies with it. Start it in tmux (or screen) so it keeps running, and reattach later:

tmux new -s codex
codex
# detach: Ctrl-b d    reattach later: tmux attach -t codex

04What about the ChatGPT desktop app's SSH hosts?

The ChatGPT desktop app on Mac or Windows can open projects on an SSH host and run Codex there, and then you can reach that work from the ChatGPT mobile app. That's a different client from running the codex CLI in your own SSH session. If you work in the CLI, the routes above are the ones that apply.

05FAQ

Why does my notify-send hook do nothing on the server?

There's no desktop session on the server, so there's nothing to show the notification. Use the escape-sequence route while connected, or a network push.

Does the built-in OSC 9 alert work through mosh?

That depends on mosh passing the sequence through, which it may not do. Test it, and use a network push if it doesn't arrive.

Can I pair a headless server with my phone?

Yes. Get the 6-digit code from the app and run the install line with it on the server. No screen or browser is needed on the server.

Does Codex need to stay connected to my laptop?

No. Codex runs on the server. Your laptop only matters for the escape-sequence route, which needs a connected terminal to show anything.

Notifier for Codex Get a push on your phone when Codex finishes or needs you, then approve, reject or answer from there. The codex-notifier command line tool is free on Mac, Windows and Linux.