Skip to content

aos menu

Search and run an app’s menu bar commands (macOS accessibility)

2 commands. Run aos menu --help for the same list from the binary, or see every group.

An app’s menu bar as a searchable list of commands, read through macOS accessibility: list prints every item as a path such as File > Export as PDF… (the frontmost app unless --app names one), and run presses one. An exact path always wins; otherwise the text must match exactly one path, and an ambiguous match is refused with the candidates listed, because running the wrong command cannot be undone. Menus are read and pressed without being opened. Needs the Accessibility permission. Windows and Linux exit 2 for now.

List every menu command of an app (frontmost by default) as a path

needs a display darwin only

Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works

Terminal window
aos menu list [--app=<name>] [--filter=<substring>] [--json]
flag values meaning
--app <name> Optional
--filter <substring> Optional
--json Optional
Terminal window
aos menu list --app=Preview
aos menu list --filter=export
aos menu list --app=Safari --json

Run a menu command by path; exact path wins, else a unique substring

needs a display darwin only

Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works

Terminal window
aos menu run <path> [--app=<name>]
flag values meaning
<path> Required positional argument
--app <name> Optional
Terminal window
aos menu run "File > Export as PDF…" --app=Preview
aos menu run "export as pdf" --app=Preview # unique substring