A small, copy-pasteable guide to make OpenAI Codex CLI play a completion sound and show a macOS notification using the Codex CLI notify hook.
setup-codex-notify.sh— Auto-setup script (recommended)- Interactive feature selection (sound / notification / both)
- Automatic backup of existing scripts
codex-notify-macos.md— Full step-by-step guide (manual setup + troubleshooting)
Run the setup script to automatically configure everything:
chmod +x setup-codex-notify.sh
./setup-codex-notify.sh- macOS
- OpenAI Codex CLI installed and working
-
Select features — choose which notifications to enable:
- Sound notification (via
afplay) - macOS notification banner (via
osascript)
- Sound notification (via
-
Backup existing — backs up your current script before overwriting
-
Configure — creates/updates
~/.codex/config.toml -
Test — optionally sends a test notification
If you prefer to set up manually:
-
Create the script:
mkdir -p ~/.codex nano ~/.codex/notify-macos.sh
Use your editor of choice if you prefer.
-
Paste the script from
codex-notify-macos.md, then:chmod +x ~/.codex/notify-macos.sh -
Add to
~/.codex/config.toml:notify = ["/bin/bash", "/Users/<your-username>/.codex/notify-macos.sh"]
(If
~expansion works in your setup,~/.codex/notify-macos.shis equivalent.$HOME/.codex/notify-macos.shis also OK.) -
Test:
~/.codex/notify-macos.sh '{}'
To remove the setup:
-
Remove the hook from
~/.codex/config.toml -
Delete the script:
rm -f ~/.codex/notify-macos.sh -
(Optional) Remove backups created by the setup script:
rm -f ~/.codex/notify-macos.sh.backup.* rm -f ~/.codex/config.toml.backup.*
PRs welcome for:
- more robust payload parsing
- alternate notification methods
- Linux equivalents
MIT License — see LICENSE file.