OSC 9 — Toast notification (iTerm2 / Windows Terminal)
Trigger a native OS desktop notification from the terminal — long-running job done, build finished, etc.
Byte forms
Every common string-literal form so you can paste-and-search either direction.
\x1b]9;MESSAGE\x07\033]9;MESSAGE\007\e]9;MESSAGE\aESC ] 9 ; MESSAGE BEL1b 5d 39 3b ... 07Description
Raise a system-tray / Notification Center / KNotifications toast with the given message string. Originally iTerm2's `iTerm2 growl` mechanism (the OSC 9 alias dates to the Growl daemon era on macOS); Windows Terminal adopted the same control later. The terminal forwards the payload to the host OS notification API — the user sees a banner outside the terminal window, useful for long compiles, `make && say done` substitutes, CI pollers. Unsupported terminals drop the entire OSC 9 frame silently, so it is safe to emit unconditionally. Caveat: ConEmu repurposes OSC 9 as its progress-bar protocol (`\x1b]9;4;<state>;<percent>\x07`) — a different scheme — so check your terminal docs before sending complex OSC 9 payloads.
Spec citation: iTerm2 Proprietary Escape Codes (OSC 9) / Windows Terminal
Examples
make && printf '\033]9;build finished\007'import sys; sys.stdout.write('\x1b]9;build finished\x07')fmt.Print("\x1b]9;build finished\x07")process.stdout.write('\x1b]9;build finished\x07')printf("\x1b]9;build finished\x07");Terminal support
- xterm
- no
- Linux console (fbcon)
- no
- macOS Terminal.app
- no
- iTerm2
- yes
- Windows Terminal
- yes
- cmd.exe / ConPTY
- no
- kitty
- no
- alacritty
- no
- WezTerm
- yes
- Ghostty
- yes
- GNOME Terminal
- no
- Konsole
- partial
- tmux
- no
- GNU screen
- no
| xterm | Linux console (fbcon) | macOS Terminal.app | iTerm2 | Windows Terminal | cmd.exe / ConPTY | kitty | alacritty | WezTerm | Ghostty | GNOME Terminal | Konsole | tmux | GNU screen |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| no | no | no | yes | yes | no | no | no | yes | yes | no | partial | no | no |
Related sequences
In the family cookbook
OSC cookbook · 6. Inline images & progress — `OSC 1337` and `OSC 9 ; 4`