All guides

Codex CLI notifications on Linux

Updated 19 November 2026 · 4 min read

On Linux, the Codex CLI sends a desktop notification by itself only in terminals that understand the OSC 9 escape sequence, such as Ghostty, Kitty and WezTerm. In GNOME Terminal, Konsole, Alacritty and most others it rings the bell instead. For a real notification in any terminal, add a Stop hook that runs notify-send 'Codex' 'Codex has finished' to ~/.codex/hooks.json, plus a PermissionRequest hook for approvals, and trust them with /hooks. notify-send comes from libnotify (libnotify-bin on Debian and Ubuntu) and needs a running notification daemon, which GNOME and KDE Plasma provide and headless servers don't.

01The built-in alert

Codex's built-in notification is on by default. It fires when a turn finishes or an approval is waiting, and by default only while the terminal isn't focused. With notification_method = "auto" it sends OSC 9 to Ghostty, iTerm2, Kitty, Warp and WezTerm and the bell character everywhere else, including GNOME Terminal, Konsole, Alacritty and other VTE terminals.

What the bell does depends on the terminal: a sound, a flashing tab, or an urgent hint that makes your window manager highlight the window. In GNOME Terminal, the bell setting is in the profile preferences. The built-in notifications guide covers the [tui] options.

02A notify-send hook

Install libnotify if you don't have notify-send:

sudo apt install libnotify-bin      # Debian, Ubuntu
sudo dnf install libnotify          # Fedora
sudo pacman -S libnotify            # Arch

Then add this to ~/.codex/hooks.json:

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "notify-send -a Codex 'Codex' 'Codex has finished'"
          }
        ]
      }
    ],
    "PermissionRequest": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "notify-send -a Codex -u critical 'Codex' 'Codex wants your approval'"
          }
        ]
      }
    ]
  }
}

Start codex, type /hooks and trust both entries. -u critical keeps the approval notification on screen until you dismiss it in most desktops. The PermissionRequest hook makes no decision, so the prompt still appears in the terminal.

notify-send prints nothing, which is what Codex wants: a Stop hook that prints plain text is treated as invalid output.

03Adding the project name

The hook receives the session's folder as cwd on stdin. This version puts it in the title, which helps when several sessions run at once:

"command": "notify-send -a Codex \"Codex: $(basename \"$(python3 -c 'import json,sys; print(json.load(sys.stdin)[\"cwd\"])')\")\" 'Codex has finished'"

That's hard to read in JSON. A script is easier: see the Stop hook guide, and swap its osascript line for notify-send.

04A sound

With PulseAudio or PipeWire:

"command": "paplay /usr/share/sounds/freedesktop/stereo/complete.oga"

The file path varies by distribution; ls /usr/share/sounds shows what you have.

05When notify-send fails

  • Nothing appears, no error. No notification daemon is running. That's normal on servers, in containers and in many minimal window managers. Install one (dunst or mako) or use a phone push instead.
  • "Cannot autolaunch D-Bus without X11 $DISPLAY". The hook can't find your desktop session. This happens over SSH and in some tmux sessions started before you logged in to the desktop.
  • Works in a terminal, not from Codex. Check /hooks shows the hook as trusted, and that hooks.json is valid JSON.

06Servers, SSH and tmux

On a remote machine, notify-send fires on the server, where nobody sees it. The OSC 9 alert and the bell travel back over SSH to your local terminal, but only while you're connected. For anything you can trust while away, send a push over the network. Codex notifications over SSH and Codex in tmux cover the details.

07Or use codex-notifier

Notifier for Codex's free codex-notifier tool supports Linux as fully as Mac and Windows. Install it with:

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

It adds its hooks to ~/.codex/hooks.json, marks them trusted, and shows a Linux desktop notification when Codex finishes, wants approval or asks a question, where a desktop is available. Pair the iPhone or Android app and those moments reach your phone too, including from a headless server, where you can approve, reject, answer or send the next instruction. It reads your idle time from the desktop where there is one, and from your last keypress in the terminal over SSH, so it only makes Codex wait for the phone when you're away. Notifier for Codex is independent and not affiliated with OpenAI; see pricing.

08FAQ

Does Codex's built-in notification work in GNOME Terminal?

It rings the bell there, not a desktop notification, because GNOME Terminal isn't one of the terminals Codex sends OSC 9 to. Use a notify-send hook for a real notification.

Does it work on Wayland?

Yes. notify-send talks to the notification daemon over D-Bus, which works the same on Wayland and X11.

Can I use notify instead of a hook?

Yes, for "finished" only. Codex's notify setting appends a JSON argument, so wrap notify-send in a small script. See the notify guide.

My hook works, but notifications pile up. Can new ones replace old ones?

Some versions of notify-send support -h string:x-canonical-private-synchronous:codex, which replaces the previous notification with the same tag in GNOME and some other daemons. Support varies.

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.