
macOS UI CLI
https://github.com/obra/macos-ui-cli- Category
- Developer Tools
- Rank
- No. 1842Tools index
Previous survey · No. 1851 ·
- Pricing
- Open Source
- Type
- TOOL
- Builder
- obra
- GitHub
- 7 stars
- Date
About
Command-line tool for inspecting and controlling the macOS UI.
What it does
It turns macOS accessibility data into shell-friendly workflows. You can locate applications, windows, buttons, and text fields, then press controls, edit text, move windows, or send keystrokes. Results can be emitted as text, JSON, or XML for people and scripts.
Why it's ranked here
Promising but clearly provisional. The command surface covers discovery, interaction, permissions, retries, and structured output, yet the repository itself warns that it may not work. Source comments also identify placeholders, while keyboard support uses a deliberately simplified character map.
What's good
The scope is unusually practical: application lookup, element traversal, button presses, text editing, window positioning, and keyboard combinations share one interface. Timeouts and retries surround several fragile accessibility operations. An app-wrapper command directly addresses macOS permission handling instead of leaving setup unexplained.
Tradeoffs
Setup requires a source build, a vendored accessibility dependency, an application wrapper, and explicit Accessibility permission. Some application metadata remains placeholder data, and focused-element handling is described as mock-oriented in the supplied source. Keyboard typing supports only a fixed character map. The permission check also falls back to window-list access.
How to use it well
Best for engineers prototyping local macOS UI scripts or testing accessibility-driven workflows from shell automation. Start with discovery and structured output, then add narrowly scoped interactions and retries. Treat operations as experimental and verify outcomes. It does not cover cross-platform desktop automation or unattended permission provisioning.
Technical notes+
Package.swift defines a Swift 5.5 executable product, links AppKit, depends on swift-argument-parser, and wraps vendored Haxcessibility through an Objective-C target. Sources/MacOSUICLI/main.swift registers grouped discovery, interaction, and utility commands plus backward-compatible top-level commands. Sources/MacOSUICLI/Window.swift and Sources/MacOSUICLI/Element.swift apply withRetry, withTimeout, and non-throwing wrappers around accessibility operations. Sources/MacOSUICLI/KeyboardInput.swift posts CoreGraphics events using a hard-coded, explicitly simplified key map. Sources/MacOSUICLI/AccessibilityPermissions.swift checks AX trust, then treats successful focused-element or window-list access as permission evidence. Sources/MacOSUICLI/CreateAppWrapper.swift writes a bundle under /Applications with a com.example identifier, copies the current executable, and adds diagnostic and launcher scripts. Sources/MacOSUICLI/ApplicationManager.swift explicitly leaves bundle identifiers and frontmost state as placeholders for real applications.
Observed
- Primary language
- Swift, with a vendored Objective-C Haxcessibility target
- Platform
- macOS 11.0 or later
- Packaging
- Swift Package Manager executable built from source
- Interface
- Command-line interface with text, JSON, and XML output
- Dependencies
- swift-argument-parser and vendored Haxcessibility, linked against AppKit
- Testing structure
- The package manifest declares a dedicated test target
Read from README.md, Package.swift, Sources/MacOSUICLI/main.swift, Sources/MacOSUICLI/Window.swift, Sources/MacOSUICLI/Element.swift, Sources/MacOSUICLI/MockModels.swift, Sources/MacOSUICLI/ButtonElement.swift, Sources/MacOSUICLI/KeyboardInput.swift, Sources/MacOSUICLI/CreateAppWrapper.swift, Sources/MacOSUICLI/TextFieldElement.swift, Sources/MacOSUICLI/ApplicationManager.swift, Sources/MacOSUICLI/MockHaxcessibility.swift, Sources/MacOSUICLI/HaxcessibilityWrapper.swift, Sources/MacOSUICLI/AccessibilityPermissions.swift, Sources/MacOSUICLI/Commands/UtilityCommands.swift.
What it can do
Inspect UI element properties
macOS UI element → Element attributes and metadata
Navigate UI element hierarchy
Starting UI element → Parent and child element tree
Click UI elements programmatically
UI element identifier → UI interaction execution
Extract text from UI elements
UI text field or label → Text content string
Query UI elements by criteria
Search parameters and filters → Matching UI elements list
Monitor UI state changes
UI element or application → Real-time state updates
Tags
Tech Stack
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.