flowdeck ui mac.
Common Flags
Most macOS UI automation commands support:--appto target a specific app by name, bundle ID, or PID. Required on most commands. Examples:--app "Safari",--app "com.apple.Safari",--app "12345".--jsonfor machine-readable output.--examples/-eto print usage examples for the command.-h/--helpfor the help screen.
click, double-click, right-click, type, erase, key, hotkey, scroll, move, drag, swipe, find, list, wait, assert, launch, activate, quit, screen, window/menu subcommands, permission commands) accept only --json, --examples/-e, and -h beyond their command-specific flags. They do not accept -v/--verbose.
Every command that can reach the cursor also takes --foreground. Actions run in the background by default — no cursor movement, no focus change — and --foreground opts out. drag, swipe, move, activate, and window focus have no background path and require it. See macOS Automation for the full rationale.
Session subcommands (session start, session stop) additionally accept -v / --verbose.
App resolution order:
- Numeric string → PID
- Contains a dot → bundle ID
- Otherwise → fuzzy match against running app names
Permissions
Capture
Query
Interaction
Keyboard
Wait and Assert
App Lifecycle
Window Management
Menu Interaction
Key Options Explained
Screen and Sessions
--outputsets the screenshot file path (PNG). If omitted, FlowDeck writes to a temp file and prints the path.--treereturns only the accessibility tree (no screenshot).--mode(boolean; no value) captures the full screen instead of the app window. Use when the app window is partially offscreen or you need surrounding context (Dock, menu bar, other windows).- Screenshots require macOS 14+ and Screen Recording permission.
- Screenshot dimensions are in pixels.
session startcaptures tree + screenshots every 500ms by default and writes to~/.flowdeck/automation/mac-sessions/<session-short-id>/(the short ID is the first 8 characters of the session UUID).session stoptakes no--app. At most one macOS UI session is active at a time, sostopis unambiguous.- Starting a session stops any active macOS session first.
--interval-msand--retention-secondstune capture frequency and retention (default 60s). Retention always keeps at least one capture.- Sessions write
latest.json,latest.jpg, andlatest-tree.jsonso automation can re-read the newest capture without listing the directory. - JSON output from
session startincludes the session directory, app name, PID, screens directory, trees directory, and thelatest_screenshot/latest_treepaths.
Find
--by-idmatches accessibility identifiers instead of labels.--by-rolematches element roles (e.g.,button,textField).--containsdoes a substring match against labels.- Returns element role, center coordinates, enabled state, and text value.
- Suggestions are provided when no exact match is found.
Click, Double-Click, and Right-Click
--by-idtreats the target as an accessibility identifier.--pointexpectsx,ycoordinates (screen-absolute, matchingfindoutput).- Pass
<target>or--point, not both. The command errors if you supply neither. --durationonclickis a long-press hold time in seconds.tapanddouble-tapare hidden aliases forclickanddouble-click.
Type and Erase
--clearclears the focused field before typing (Select All + Delete).--delay-msoverrides the per-character typing delay.--maskhides the typed text in terminal output and JSON (useful for passwords).erase --characters 5deletes a specific number of characters; omit to clear all.
Key and Hotkey
key --nameaccepts key names:return,escape,tab,delete,space,f1–f12, arrow keys, etc.key --keycodeaccepts raw virtual keycodes.- Pass
--nameor--keycode, not both. The command errors if you supply neither. hotkeyaccepts modifier+key combos:cmd+s,cmd+shift+z,ctrl+alt+delete.- Command-key combos are unreliable against a backgrounded app. Whether a
cmd+...combo lands depends on how the target app installs the shortcut, and a combo that doesn’t land is still reported as success. Useui mac menu click "File > Save"when the result matters — it goes through accessibility and always works in the background — or pass--foregroundafter asking the user. - Supported modifiers:
cmd/command,shift,ctrl/control,alt/option.
Scroll
--directionis required:up,down,left, orright.--amountsets the scroll magnitude in discrete ticks (default:3).--smoothenables many small ticks with delays for smooth scrolling.--untilscrolls repeatedly until the target element appears. Useid:myElementfor accessibility ID matching.--timeoutsets the deadline for--untilin seconds (default:30).- Scroll is performed at the center of the app’s focused window.
iOS
ui simulator scroll --timeout is in milliseconds; macOS ui mac scroll --timeout is in seconds. Same flag, different unit — never copy values across platforms.Move, Drag, and Swipe
move --pointexpectsx,yscreen-absolute coordinates.move --appis optional. The cursor moves to the absolute screen point regardless of which app is focused; the flag only validates that the named app exists.move,drag, andswipeare foreground-only: they take the real cursor, so they require--foregroundand exit non-zero without it.drag --fromand--toexpectx,ycoordinates.--durationis in seconds (default:0.5).swipe --directionacceptsup,down,left,right.--distanceis in points (default:200).
Wait
--conditionaccepts one of:exists(default),gone,enabled,stable. Invalid values are rejected with an error.exists— element is present in the accessibility treegone— element is not presentenabled— element is present andenabled = truestable— element’s frame stops moving between polls (use to wait for an animated transition to settle)
--timeoutis in seconds (default:30).--by-idtreats the target as an accessibility identifier.
Assert
Assert element conditions with immediate pass/fail (no polling). Exits with failure if the assertion does not hold. Subcommands:
Common Options:
Text Options:
App Lifecycle
launchuses--bundle-id, not--app. It targets the installed bundle directly, not a running process. Discover bundle IDs withui mac list apps --json.activate --appbrings a running app to the foreground. It requires--foreground, because raising an app takes the user’s screen. You rarely need it: every action command already reaches a background app.quit --appsends a graceful terminate.--forceforce-quits.
Window Management
--indexselects which window (default:0, the first/main window).window move --toexpectsx,yfor the new origin.window resize --sizeexpectsw,hfor the new dimensions.
Menu Interaction
menu listshows the app’s menu bar hierarchy with titles, shortcuts, and enabled state.menu clicknavigates a menu path using>separators.
List
list appsshows running GUI applications with PID, name, and bundle ID.--include-agentsincludes background agent apps.--include-systemincludes system processes.list windowsrequires--app.list screensshows connected displays with frame and scale info.list permissionsshows Accessibility and Screen Recording status.
Coordinate System
- All coordinates are screen-absolute points (matching what
findreturns). - Multi-display setups use the global coordinate space (origin at primary display top-left).
- Do not apply Retina scaling; use coordinates as reported by
findandlist screens. - Use
flowdeck ui mac list screensto see display layouts and pixel densities.
Coordinate Format
All point and size flags on macOS use comma-separatedx,y (or w,h for sizes). Space-separated values are rejected with a live error:
--point, --from, --to, and --size across click, double-click, right-click, move, drag, window move, and window resize.
Timing Tuning
Set these environment variables to adjust input timing:FLOWDECK_HID_STABILIZATION_MSadds settle time between input events (default:25)FLOWDECK_TYPE_DELAY_MSadds per-character typing delay (default:1)
Performance and Reliability Tips
- Start a session before any macOS UI work. Run
flowdeck ui mac session start --app "MyApp" --json, parse the JSON output to getlatest_screenshotandlatest_tree, then read those files to inspect the current UI. - macOS UI sessions remain single-active and stop automatically when the owner process that started them exits. Set
FLOWDECK_OWNER_PIDto bind a session to a specific owner process. - Verify after every action. After each click/type/scroll, wait briefly, then re-read
latest_screenshotandlatest_treeto confirm the UI changed. - Use accessibility identifiers and
--by-idwhenever possible; label matching is slower and more ambiguous. - For automation loops, re-read
latest-tree.json/latest.jpgfrom disk instead of issuingscreenfor every step. The session updates these files automatically. - Use
ui mac screen --tree --json --app "MyApp"for one-off tree-only checks when you do not need a running session.
flowdeck ui mac --help.