All guides

Codex in tmux or screen: getting notified from a detached session

Updated 19 November 2026 · 4 min read

Inside tmux, the Codex CLI's desktop notifications only reach your outer terminal if tmux passes them through: add set -g allow-passthrough on to ~/.tmux.conf. Codex already wraps its OSC 9 notification in tmux's passthrough sequence when it detects tmux, so that one setting is usually all it takes while you're attached. Once you detach, no terminal is showing the session, so nothing on screen can alert you, but Codex keeps running and its hooks keep firing. To hear from a detached session, use a hook that sends a push over the network instead of one that relies on a terminal.

01While you're attached

OSC 9 notifications

Codex's built-in alert sends an OSC 9 escape sequence to terminals that support it (Ghostty, iTerm2, Kitty, Warp and WezTerm). Inside tmux, Codex wraps that sequence in tmux's DCS passthrough. tmux 3.3 and later drop passthrough sequences unless you allow them:

# ~/.tmux.conf
set -g allow-passthrough on

Reload with tmux source-file ~/.tmux.conf. If you still get nothing, tell Codex which method to use rather than letting it guess from inside tmux:

# ~/.codex/config.toml
[tui]
notification_method = "osc9"

By default Codex only alerts when the terminal is unfocused. If focus changes don't reach Codex through tmux, alerts may never fire; notification_condition = "always" under [tui] avoids the question, at the cost of alerts while you're watching. Turning on set -g focus-events on in tmux may also help.

The bell

If your outer terminal doesn't support OSC 9, Codex rings the bell. tmux handles bells itself:

# ~/.tmux.conf
set -g monitor-bell on
set -g bell-action any
set -g visual-bell off

bell-action any makes a bell in any window flag that window in the status bar and pass the bell to your terminal, so a Codex session in another window still gets your attention. Set notification_method = "bel" under [tui] if you want the bell everywhere.

Name the windows

When several sessions share one tmux server, name each window after its project so the flag tells you which one needs you:

tmux new-window -n billing-svc

02When you're detached

Detached, nothing draws the session, so terminal alerts have nowhere to go. Codex is still running, though, and hooks don't care about the terminal. A hook that makes a network request works the same attached or detached:

  • ntfy: a curl to your topic from a Stop and a PermissionRequest hook.
  • Telegram, Slack or Discord: a webhook post.
  • Notifier for Codex: a push to your phone that you can answer.

Remember to trust new hooks with /hooks, and keep them silent: a Stop hook that prints text (such as curl's response) is treated as invalid output, so use curl -s -o /dev/null.

03Answering a detached session from your phone

Getting told is half the job; the other half is answering without reattaching. Notifier for Codex's free codex-notifier tool (Mac, Windows and Linux) installs hooks that send approvals, questions and "finished" to the iPhone or Android app and return your answer to Codex:

curl -fsSL https://notifierforcodex.com/install.sh | sh

Approvals and question answers go back through Codex's hooks, so they work in any terminal. tmux adds one extra: Codex sessions inside tmux can also take a free-text reply from the phone when the session is sitting idle, which codex-notifier doctor reports on its "replies" line. Within two minutes of a turn ending, a follow-up from the phone works in any terminal.

codex-notifier waits for the phone only when you're away from the keyboard, so typing in the tmux session keeps everything in the terminal. Notifier for Codex is independent and not affiliated with OpenAI.

04GNU screen

OSC 9 alerts don't reliably make it through screen to the outer terminal. Use the bell (notification_method = "bel"; screen shows a bell message and flags the window) while attached, and network pushes for detached sessions.

05FAQ

Why do I get the bell but no desktop notification inside tmux?

Either allow-passthrough is off, so tmux drops the OSC 9 sequence, or Codex chose the bell because it couldn't tell which terminal is outside tmux. Turn on passthrough and set notification_method = "osc9".

Will Codex keep running if I detach?

Yes. Detaching only disconnects your view. Codex and its hooks keep running inside tmux. It stops only if the machine sleeps or the tmux server is killed.

Do hooks behave differently inside tmux?

No. Hooks run from Codex, not from the terminal, so they fire the same way attached, detached or outside tmux.

Which tmux version do I need?

allow-passthrough was added in tmux 3.3, and on 3.3 and later it is off by default. Check yours with tmux -V.

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.