Installation
Install agent-device on the machine where your coding agent runs terminal commands.
Requirements
- Node.js 22.12 or newer
- Node.js 24 or newer for web automation. Web commands fail on older Node.js versions, so check
node --versionin the shell that runsagent-device web setupandagent-device doctorbefore you trust a web result. - Xcode for iOS simulator and device automation (
simctlanddevicectl).agent-deviceuses the Xcode inDEVELOPER_DIR, otherwise the one fromxcode-select -p. ADEVELOPER_DIRexported in the shell where you runagent-deviceapplies to that command, even when a local daemon is already running; without it, the daemon uses the environment it started in. SetDEVELOPER_DIR=""to use the daemon host'sxcode-selectselection instead. - Android SDK and ADB for Android
- HarmonyOS Command Line Tools for HarmonyOS (
hdcavailable throughHDC_SDK_PATH,DEVECO_SDK_HOME, orHARMONYOS_COMMAND_LINE_TOOLS) - Amazon Vega Developer Tools and an SDK-matched Vega Virtual Device for Vega OS TV
- Swift 5.9 or newer (Xcode command-line tools) for macOS desktop targets.
agent-devicebuilds its local macOS helper on first use
Global install
Run agent-device doctor yourself after installing to check that local devices, toolchains, and
dev servers are ready before you hand the CLI to an agent.
A global install gives agents a stable agent-device command. Start with the core workflow guide; Commands lists the other help topics:
For Cursor, Codex, Claude Code, Windsurf, Cline, Goose, skills, and project rules, see AI Agent Setup; to expose commands as MCP tools with agent-device mcp, see MCP server. If an agent can't find agent-device after a global install, see Fix a missing agent-device command. For the first app automation commands, see Quick Start.
Update the CLI
Interactive CLI runs periodically check npm for a newer agent-device release in the background. When one is available, the CLI suggests reinstalling globally:
Set AGENT_DEVICE_NO_UPDATE_NOTIFIER=1 to disable the notice.
Without installing
One-off npx use is fine for you and for scripts that intentionally fetch from npm. For agents, use a global install, a project-local install, or a version pinned by you or your project config, so repeated commands resolve to a known CLI. Don't let agents choose a version or run npx -y agent-device@latest unless you've decided to trust whatever npm serves.
Vega OS TV prerequisites
Install the Amazon Vega Developer Tools and a matching Vega SDK and Vega Virtual Device (VVD) with Amazon's installer, then load its environment and verify the tools:
- Start and stop the local emulator with
vega virtual-device startandvega virtual-device stop;agent-devicedoes not boot it implicitly. - Appium is optional. You don't need it for device discovery, app lifecycle, or remote-button control.
- For selecting the VVD and what Vega OS supports, see TV targets.
macOS desktop notes
- macOS desktop automation uses a local
agent-device-macos-helperfor permission checks (settings permission ...), alert handling, and thefrontmost-app,desktop, andmenubarsnapshot surfaces. agent-devicebuilds the helper on first use and after updates, and caches it under~/.agent-device/macos-helper/current/.- To use your own helper build, set
AGENT_DEVICE_MACOS_HELPER_BINto its absolute executable path.
iOS physical device prerequisites
Run agent-device help physical-device for the same setup guidance from the CLI.
- Xcode is installed with
xcrun devicectlandxcrun xctraceavailable. - The device is paired, trusted, connected, unlocked when needed, and listed by
xcrun devicectl list devices. - Developer Mode is on in the device's Settings.
- The Apple runner must be signed before commands can run on the device. Start with Automatic Signing in Xcode and these environment variables; add the others below only when needed:
AGENT_DEVICE_IOS_TEAM_IDAGENT_DEVICE_IOS_BUNDLE_ID(optional base bundle ID for the runner app; its tests use<id>.uitests)
- To find team IDs and Apple Development signing certificates, run
security find-identity -v -p codesigning. - If Xcode can't choose a provisioning profile, set
AGENT_DEVICE_IOS_PROVISIONING_PROFILEto the profile name, not a file path. - Set
AGENT_DEVICE_IOS_SIGNING_IDENTITYonly whenxcodebuildasks for a specific identity. - The profile and team must allow both
AGENT_DEVICE_IOS_BUNDLE_IDand<id>.uitests. - Free Apple Developer (Personal Team) accounts can fail with "bundle identifier is not available" for generic IDs. Set
AGENT_DEVICE_IOS_BUNDLE_IDto a unique reverse-DNS value (for examplecom.yourname.agentdevice.runner). - When the runner fails to start,
error.details.reasonis one ofsigning_no_development_team,signing_provisioning_profile_missing,bundle_identifier_already_registered,signing_unspecified,devtools_security_developer_mode_disabled(the Mac'sDevToolsSecuritysetting, which says nothing about the device's Developer Mode toggle),device_developer_mode_disabled,device_developer_disk_image_unavailable, orbuild_failed_unclassifiedwhen the cause is unknown. Branch ondetails.reasonand followhint; the error code isCOMMAND_FAILEDfor every reason. - The two
device_*reasons come from the device itself (xcrun devicectl device info details), checked before the runner builds.device_developer_mode_disabledmeans the Developer Mode toggle in Settings is off; turn it on.device_developer_disk_image_unavailablemeans Developer Mode is on but the developer disk image isn't available yet, usually because device support is still installing; wait and retry. - The first run builds the Apple runner and takes longer than later commands. Keep the device connected; if setup times out, retry with
--debugto see signing and build diagnostics. - If you set
AGENT_DEVICE_IOS_RUNNER_DERIVED_PATHtogether withAGENT_DEVICE_IOS_CLEAN_DERIVED, keep the path in a subdirectory of the project's.tmp/directory. For any other path, the command fails instead of cleaning it, and the error hint names both fixes.
Troubleshoot daemon startup and upgrades
If the daemon fails to start, retry with --debug and check the state directory and diagnostics. agent-device session state-dir prints the resolved directory without starting a daemon.
Before you upgrade from a version that predates the current daemon lock format, stop every older client and daemon that uses the state directory, using their original CLI. Don't let older versions restart while the upgraded version runs. To run several versions at once, give each its own environment and state directory.
If you ran a source checkout from before state directories were per worktree, stop its daemon in ~/.agent-device from that older checkout:
An upgraded checkout uses a different default directory, so a plain pnpm clean:daemon there doesn't reach the old daemon.
The daemon refuses to start when it finds a legacy lock file or can't verify who owns the state directory. Before you recover manually, confirm that every client and daemon using the directory has stopped. Deleting daemon.json or daemon.lock alone is not a safe reset.
Packaged installs use ~/.agent-device by default; source checkouts use a per-worktree directory under ~/.agent-device/dev/. Set AGENT_DEVICE_STATE_DIR or pass --state-dir to override either default.
In a source checkout, pnpm clean:daemon --prune-dev first stops the current checkout's daemon, even if its state directory was used recently. It then finds development state directories with no activity for 14 days (by the newest modification time of the directory and its immediate children) and removes daemon registrations it can confirm are abandoned. It keeps the directories, session artifacts, and logs.
