Skip to main content
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

See AXEngine.swift:65-119 for the app launching implementation.
2

Snapshot to find elements

The -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

Every element in the snapshot has a ref (like @n5) that you can use for interactions.
4

Re-snapshot after navigation

Important: Always re-snapshot after clicking navigation elements. The UI structure changes, and old refs become invalid.
Refs are invalidated when the UI structure changes. Always re-snapshot after navigation actions.

Example: Configuring Wi-Fi

Here’s a complete example of connecting to a Wi-Fi network:
See test/integration.sh:1-286 for more examples of automated testing patterns.

Common patterns

Finding sidebar items

System Settings uses a sidebar for navigation. Items are typically AXStaticText or AXButton elements:
System Settings has a search field that can quickly navigate to settings:

Toggling checkboxes

Use check and uncheck commands, which are idempotent:
See InteractionCommands.swift for implementation details.

Reading current values

Use the get command to read element states:
See GetCommand.swift and IsCommand.swift for details.

Example: Adjusting display settings

Example: Checking system information

Using JSON output

For programmatic access, use --json flag:
Parse with jq:
See SnapshotCommand.swift:105-111 for JSON encoding implementation.

Filter-based commands

You can interact with elements by filter instead of refs:
This is useful for one-off commands, but refs are more reliable for multi-step workflows. See ElementResolver.swift:6-51 for filter resolution logic.

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

Problem: @n5 doesn’t resolve after navigation.Cause: Old refs are invalid after UI changes.Solution: Re-snapshot after each navigation:
Problem: System Settings shows permission dialogs.Solutions:
  1. Use wait to wait for dialogs:
  2. Snapshot the dialog and interact with it:
Problem: Expected element doesn’t appear in snapshot.Solutions:
  1. Remove -i flag to see full tree:
  2. Increase depth with -d flag:
  3. Use find to 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