Keep Cua Driver running
Register Cua Driver as a persistent daemon that starts automatically and survives reboots.
Use a persistent daemon for element-indexed workflows. The per-pid element cache lives inside the process, so one-shot CLI invocations drop that cache between calls. The daemon also gives macOS the right TCC attribution and gives Windows an interactive-session proxy.
cua-driver autostart is not implemented for macOS yet. Write a LaunchAgent with install-local.sh --autostart:
bash libs/cua-driver/scripts/install-local.sh --autostartYou can also create the plist yourself. Save this file at ~/Library/LaunchAgents/com.trycua.cua-driver.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.trycua.cua-driver</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/CuaDriver.app/Contents/MacOS/cua-driver</string>
<string>serve</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>Load the LaunchAgent:
launchctl load ~/Library/LaunchAgents/com.trycua.cua-driver.plistA LaunchAgent daemon starts under launchd and is attributed to com.trycua.driver. Grant Accessibility and Screen Recording once, and those grants persist across reboots. If you start prompts from a terminal without a LaunchAgent, macOS attributes them to the terminal instead of the driver, so the grants do not apply to Cua Driver.
Verify it's running
cua-driver status
# Cua Driver daemon is running
# socket: /Users/you/Library/Caches/cua-driver/cua-driver.sock
# pid: 12345On Windows the socket path is \\.\pipe\cua-driver and status also reports the session number.
Stop it cleanly
cua-driver stopThis sends a shutdown signal to the daemon process. The autostart entry, whether LaunchAgent, Scheduled Task, or systemd unit, remains registered and starts it again on the next logon or trigger.