Version Requirement: CLI automation is only available in Badgeify version 1.9.2 and later.
Please update to the latest version if you’re running an older release.
Badgeify Command-Line Interface
Badgeify bundles a lightweight CLI inside the desktop binary so automations can inspect notification badges without launching the UI. Run theBadgeify
executable with one of the supported subcommands to query state and exit immediately.
0
on success and 1
on error. Errors are emitted on stderr.
Prerequisites
- Badgeify must already be configured with the apps or groups you want to monitor.
- macOS accessibility permissions are required. If the CLI fails with a
NO_PERMISSIONS
error, grant access via System Settings → Privacy & Security → Accessibility and relaunch Badgeify once to register the permission.
Discover Available IDs
Uselist
to retrieve the apps and groups that can be queried. Each entry exposes an id
, type
, name
, and whether it is currently enabled.
id
field becomes the argument for other subcommands.
Free tier note: Without an active license, only the first three configured items are returned.
Query Unread Status
Fetch the current menubar badge for a specific app or group withstatus
and the --id
flag.
unread
– integer badge count (0 when cleared).statusLabel
– raw menubar badge text (mirrors what macOS reports).shown
– whether the item is currently visible in the Badgeify tray.isRunning
– whether the underlying app is running right now.
NOT_FOUND
error:
Free tier note: For unlicensed users,status
is limited to the first three configured items and returns aFORBIDDEN
error for others.
Exit Codes
0
– Command succeeded and JSON was printed to stdout.1
– Validation, permission, or runtime error; JSON error payload printed to stderr.
Automation Tips
- The CLI sets the
BADGEIFY_CLI_MODE=1
environment variable while running. You can detect this flag inside scripts if needed. - Poll
Badgeify status --id <bundle>
on an interval to react to badge changes from tools like Hammerspoon. - Parse stdout as JSON to inspect
unread
. For shell scripting, tools such asjq
make it easy:Badgeify status --id com.apple.Mail | jq '.data.unread'
Troubleshooting
Symptom | Likely Cause | Resolution |
---|---|---|
NO_PERMISSIONS error | Accessibility access not granted | Open System Settings, add Badgeify to Accessibility, relaunch the app |
CLI exits without printing JSON | Command failed before reaching the handler | Re-run with Badgeify --help to verify syntax; check stderr for the error payload |
Badge count differs from macOS dock | The monitored app may suppress menubar badges or accessibility APIs | Confirm the badge appears in the macOS menu bar. Badgeify reports exactly what macOS exposes |