System Settings (formerly System Preferences) is a native macOS app with a rich Accessibility tree that works well with agent-native.
Overview
System Settings exposes excellent Accessibility support, making it ideal for automation. Common use cases include:- Configuring Wi-Fi networks
- Adjusting display settings
- Managing accessibility permissions
- Toggling system features
- Checking system information
Core workflow
The standard workflow for automating System Settings:1
Open System Settings
2
Snapshot to find elements
-i flag shows only interactive elements (buttons, checkboxes, text fields). This keeps the output focused and manageable.See SnapshotCommand.swift:14-19 for the snapshot flags.3
Interact using refs
ref (like @n5) that you can use for interactions.4
Re-snapshot after navigation
Example: Configuring Wi-Fi
Here’s a complete example of connecting to a Wi-Fi network:Common patterns
Finding sidebar items
System Settings uses a sidebar for navigation. Items are typicallyAXStaticText or AXButton elements:
Using search
System Settings has a search field that can quickly navigate to settings:Toggling checkboxes
Usecheck and uncheck commands, which are idempotent:
Reading current values
Use theget command to read element states:
Example: Adjusting display settings
Example: Checking system information
Using JSON output
For programmatic access, use--json flag:
jq:
Filter-based commands
You can interact with elements by filter instead of refs:Best practices
Always use -i flag
The
-i flag filters to interactive elements only, making snapshots much more readable:Re-snapshot after navigation
UI changes invalidate old refs. Always re-snapshot after clicking:
Add delays
System Settings animations take time. Add small delays:
Use search for speed
The search field is the fastest way to navigate:
Common settings to automate
Wi-Fi
- Connect/disconnect networks
- View available networks
- Configure network settings
- Toggle Wi-Fi on/off
Display
- Adjust brightness
- Change resolution
- Enable Night Shift
- Arrange displays
Sound
- Adjust volume
- Select input/output devices
- Configure alert sounds
Privacy & Security
- Grant accessibility permissions
- Manage app permissions
- Configure FileVault
Network
- Configure firewall
- Manage VPN connections
- View network status
Troubleshooting
Ref not resolving
Ref not resolving
Problem:
@n5 doesn’t resolve after navigation.Cause: Old refs are invalid after UI changes.Solution: Re-snapshot after each navigation:Permission dialogs
Permission dialogs
Problem: System Settings shows permission dialogs.Solutions:
- Use
waitto wait for dialogs: - Snapshot the dialog and interact with it:
Elements not found in snapshot
Elements not found in snapshot
Problem: Expected element doesn’t appear in snapshot.Solutions:
- Remove
-iflag to see full tree: - Increase depth with
-dflag: - Use
findto search:
Next steps
Electron apps
Learn to automate Slack, Discord, and VS Code
Safari automation
Interact with web content in Safari
API reference
Explore all available commands
Troubleshooting
Fix common issues and errors