Use osascript -e 'display notification "message" with title "Title" subtitle "Sub"' to post a Notification Center alert from the command line.
For a blocking modal, use osascript -e 'display dialog "message" with title "Title" buttons {"Cancel", "OK"} default button "OK"' and capture the button returned.
Check the exit code (0 = OK/default, 1 = cancel/closed) when driving logic from the dialog result.
For scripted workflows needing user input, add 'default answer "placeholder"' to display dialog to show a text-entry field; retrieve via 'text returned of result'.
Wrap osascript calls in a shell function and test on the target macOS version — display notification behaviour via Terminal may differ on newer OS releases.
Known gotchas
display notification from osascript in Terminal may be suppressed or behave differently on recent macOS releases; test on the target system rather than relying on older docs.
display dialog blocks the calling process until dismissed; avoid calling it from background launchd jobs where no user session is guaranteed.
Notification Center requires the delivering process to have an app bundle identity in some configurations; pure command-line calls may not always show a persistent banner.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp