CLI
What each command accepts. The Guide column links the task page that uses it. Error codes: Errors.
Commands at a glance
Section titled “Commands at a glance”| Command | What it does | Guide |
|---|---|---|
simlock lease |
Lease a device and hold it until the command exits | Keep a device for a long task |
simlock release |
Give a lease back | Keep a device for a long task |
simlock simctl |
Run xcrun simctl against Simlock’s simulators |
Run simctl or adb on a device |
simlock adb |
Run adb against Simlock’s emulators |
Run simctl or adb on a device |
simlock rotate |
Turn your leased iOS simulator to portrait, portrait-upside-down, landscape-left or landscape-right | Run simctl or adb on a device |
simlock files |
Move files to and from your lease’s folder on its worker, from another machine | Copy files to and from a device |
simlock tunnel |
Connect ports between your machine and a leased Android device or iOS simulator on another machine | Use your own tools through a tunnel |
simlock catalog |
Show the models, runtimes and images you can lease | Lease a specific model or OS |
simlock mcp |
Start the MCP server for an agent | Give your agent the MCP server |
simlock instructions |
Print the rules an agent must follow, for its prompt | Connect your coding agent |
simlock setup |
Install the Simlock skill into Claude Code and Codex | Connect your coding agent |
simlock status |
Show the daemon, its devices and its leases | See what the worker is doing |
simlock list |
List devices, leases, cleanup rules or waiting requests | See what the worker is doing |
simlock events |
Print what happened: leases, devices, workers, installs | See what the worker is doing |
simlock stats |
Show usage figures for a time window | See what the worker is doing |
simlock update |
Install the newest Simlock (or a named version) and restart the daemon | Start, stop and update the daemon |
simlock whoami |
Show who the daemon thinks you are | Tokens and roles |
simlock daemon |
Start, stop and inspect the daemon | Start, stop and update the daemon |
simlock config |
Read and change the daemon’s configuration | Change a setting |
simlock doctor |
Check the machine and fix Simlock’s records | A worker misbehaves |
simlock cleanup |
Run the cleanup rules now | Free disk space |
simlock nuke |
End every lease and stop every device at once | Free disk space and reset a machine |
simlock seed |
Make and settle the seed of a model before anyone leases it | Settle a seed before the first lease |
simlock warm |
Forget a kind the warm pool learned from a lease | Make leases start faster |
simlock component |
Install, list and remove runtimes and system images | Install iOS runtimes and Android images |
simlock baseline |
Save a held device as a named baseline, list baselines, remove one | Save a prepared device |
simlock device |
Enrol or forget a physical device | Enrol a phone |
simlock token |
Create, list and revoke access tokens | Give agents and people access |
simlock worker |
List and manage a gateway’s workers | Maintain workers |
simlock alerts |
Send a sample message to an alert destination | Send alerts |
simlock --version (or -v) prints the installed Simlock version and exits 0, without contacting a daemon.
Every command and subcommand also accepts --help (or -h), which prints its usage and exits 0. A flag a command does not list is a usage error (exit 2).
Global flags
Section titled “Global flags”These flags work anywhere on the command line, before or after the command.
| Flag | Meaning | Default |
|---|---|---|
--token <secret> |
The credential a command sends: the admin token for the local daemon, or the bearer token for a farm (see Remote mode). --token=<secret> also works. |
See Admin credential |
--url <url> |
The farm to run the command on: a standalone worker or a gateway, https://, or http:// only for 127.0.0.1, [::1] or localhost unless you pass --allow-insecure-http; the origin only, with no path, query or fragment (a trailing / is fine); at most 2048 characters. --url=<url> also works. A --url that is not valid is a usage error. |
SIMLOCK_URL. See Remote mode |
--gateway |
Send the command to this machine’s gateway, the daemon in ~/.simlock/gateway. Takes no value. |
See Which daemon a command reaches |
--local |
Send the command to this machine’s worker, the daemon in ~/.simlock. Takes no value. |
See Which daemon a command reaches |
--allow-insecure-http |
Let a farm URL be http:// to any host, not only 127.0.0.1, [::1] or localhost. The token then travels unencrypted. Takes no value (--allow-insecure-http=1 is a usage error). Read only when a command checks a farm URL. |
SIMLOCK_ALLOW_INSECURE_HTTP=1 |
--help, -h |
As the first word, or with no command: print the list of commands. | — |
--gateway and --local together are a usage error, and so is --gateway=yes or --local=yes. So is --url with either of them.
Which daemon a command reaches
Section titled “Which daemon a command reaches”With --gateway, the command goes to the gateway. With --local, it goes to the worker. With neither, it goes to the gateway only when this machine has a gateway (~/.simlock/gateway holds an instance.json or config.json) and no worker has started here yet (~/.simlock/instance.json does not exist). Otherwise it goes to the worker.
simlock --gateway <command> on a machine with no gateway fails with GATEWAY_NOT_PRESENT (exit 2) and starts nothing. These commands are exempt, because they create the gateway, run before it or never contact a daemon: daemon start, daemon install, daemon uninstall, config set, mcp, instructions and setup. When the command goes to the gateway (--gateway, or a machine that has only a gateway), setup installs the skill, never connects to it and prints machine not checked: setup does not check a gateway; otherwise it checks the worker.
When a worker refuses a gateway-only command, such as worker drain, and a gateway also runs on this machine, the error message ends with A gateway also runs on this machine: run the command again with --gateway.
Remote mode
Section titled “Remote mode”With a farm URL (--url, else SIMLOCK_URL; an empty SIMLOCK_URL counts as unset) and a token (--token, else SIMLOCK_TOKEN), every command whose work is the daemon’s runs on that farm instead of this machine’s daemon. The token’s role is the command’s role: an agent token gets the agent commands, an operator token gets every command. Nothing starts a daemon on this machine, falls back to an agent session or reads SIMLOCK_ADMIN_TOKEN or the admin.token file. A URL with no token is a usage error (No token: pass --token or set SIMLOCK_TOKEN). A token the farm refuses fails with UNAUTHENTICATED (exit 1), and a farm that does not answer with REMOTE_UNREACHABLE (exit 1).
--local or --gateway beats SIMLOCK_URL, so a variable left in a shell does not stop you from reaching this machine’s daemon.
These commands act on this machine and exit 2 in remote mode, with `simlock <command>` acts on this machine; it does not run with --url or SIMLOCK_URL. Run it on the daemon's machine, or unset SIMLOCK_URL.: daemon start, daemon stop, daemon status, daemon logs, daemon install, daemon uninstall, config set and setup.
A few commands differ in remote mode:
simlock simctlandsimlock adbalways run on the lease’s worker, asdevice.exec, also when the farm is a standalone worker. A path in their arguments names a file on the worker;simlock files putuploads one.- Without
--lease,simctl,adbandrotateuse the one lease whose requester is this command’s requester:SIMLOCK_AGENT_ID, else the agent session’s id, else this process. Another requester’s lease on the same token is never picked. With no such lease, or with several, the command is a usage error. simlock leasewhose requester is this process prints one notice saying that later commands needSIMLOCK_AGENT_IDor--lease.events --sincereplays the farm’s history; it never reads this machine’shistory.db.baseline listandbaseline removefollow the farm’s mode, a worker or a gateway, not this machine’s folder.
A held simlock lease and simlock mcp ride out a dropped connection, and 45 seconds with no ping from the farm counts as one. Each prints a lost the connection to <url> notice, then connects again after 1, 2, 4 and 8 seconds and every 15 seconds after that, and prints reconnected to <url>; lease <id> renewed once it renews. While the request still waits in the queue, the command sends it again under the same idempotency key, so the farm holds one request; if the worker restarted and dropped it, simlock lease asks once more and says so, while the lease_simulator call of simlock mcp fails with the farm’s answer. The tries stop at the lease’s deadline, which ends the command as a lost lease (exit 14); a request that has no --timeout and cannot reach the farm for 5 minutes fails with REMOTE_UNREACHABLE (exit 1). A reconnect the farm refuses (UNAUTHENTICATED, PROTOCOL_VERSION_UNSUPPORTED) ends the command at once with that code, and the stderr line says the lease is still yours until its deadline. Ctrl-C while disconnected connects once to release the lease, or to cancel the request that still waits. On this machine’s own daemon a dropped connection still ends the command.
Admin credential
Section titled “Admin credential”Most commands that change or inspect the whole machine need the admin role. The CLI uses the first credential it finds:
--token <secret>.- The
SIMLOCK_ADMIN_TOKENenvironment variable. - The
admin.tokenfile the daemon writes into its data folder (~/.simlockfor a worker,~/.simlock/gatewayfor a gateway).
If none is found, or the daemon rejects the one found, the CLI connects as an agent and writes one notice line to stderr:
{"notice":"admin credential unavailable; connecting as agent (admin-only commands will fail with FORBIDDEN)"}An admin-only command then fails with FORBIDDEN (exit 1). On the machine where the daemon runs, as the same user, the admin.token file makes you admin with no setup.
The daemon starts on demand
Section titled “The daemon starts on demand”A command that needs the daemon starts it when nothing is listening. The CLI checks the configuration first, so a bad config.json fails on the command’s stderr. If the daemon does not answer within 20 seconds, or exits while starting, the command fails with DAEMON_STARTUP_FAILED (exit 1) and the message carries the daemon’s own start error. daemon stop, daemon status and events --since (without --follow) never start a daemon.
simlock lease
Section titled “simlock lease”Lease a device. The command waits for a device, prints the grant, then stays running: it renews the lease and releases it when the command ends. See Keep a device for a long task and Lease a specific model or OS.
simlock lease --platform <ios|android> [--device <model> | --class <class>] [--os <version|range>] [--mode <slim|full>] [--image-tag <tag>] [--agent-id <id>] [--except <category,...>] [--baseline <name>] [--requires <capability,...>] [--timeout <duration>] [--lease-id <id>] [--physical] [--no-wait] [--detach] [--ttl <duration>] [--allow-download] [--run <id>] [--label <text>] [--meta <key=value>]... [--export-env] [--bind-pid <pid>]| Flag | Meaning | Default |
|---|---|---|
--platform <ios or android> |
The platform to lease on. Required. | — |
--device <model> |
An exact model, such as "iPhone 16" or "Pixel 9". Cannot be combined with --class. |
None |
--class <class> |
Any model of this class: phone, tablet, watch, tv, vision, auto or desktop. |
phone when --device is not given |
--os <version or range> |
An exact OS version (18.4, 35), or a range such as >=18 <26 or 18 - 26. A range never downloads. |
The newest runtime installed for the platform |
--mode <slim or full> |
The device mode. full is guaranteed; slim is best effort and falls back to full. |
The serving worker’s default mode (full unless configured) |
--except <category,...> |
iOS only: keep these slim categories running on a slim simulator, such as store,other. One to 16 names, each lowercase letters, digits and -, starting with a letter, none twice. Needs a slim lease: a --mode full, a worker whose default mode is full with no --mode, a full --baseline, --physical and --platform android are each a BAD_REQUEST. The grant’s device.except lists them; on a runtime older than iOS 18.5 you get a full device with no except. See Slim iOS simulators. |
None: the worker’s whole slim set is turned off |
--requires <capability,...> |
Lease only from a worker that has every name, such as bank-network,eu-west: a module a worker runs, such as screen streaming, or a tag an operator gave it. At most 8 names, each lowercase letters, digits and -, starting with a letter, none twice; a bad list is a BAD_REQUEST. With --url, the farm places the lease on a worker that has them all, and CAPABILITY_MISSING names those no worker has. |
None: any worker |
--image-tag <tag> |
Android only: the system image type, such as google_apis_playstore. Never downloads. |
Simlock picks an installed image |
--baseline <name> |
Start from a saved baseline: the device is a new copy of it, with the operator’s apps, files and settings. The SIMLOCK_BASELINE environment variable sets it when the flag is absent; an empty value sends nothing. Cannot be combined with --class or --physical. See Lease a prepared device. |
None: a plain device |
--agent-id <id> |
The requester identity for this lease. Must not be empty, hold no control characters, and be at most 256 characters. | See Requester identity |
--timeout <duration> |
How long to wait in the queue before failing with QUEUE_TIMEOUT (exit 10). |
No limit: waits until a device is free |
--lease-id <id> |
The ID the lease gets, in place of a generated one. 1 to 64 letters, digits, - and _, starting with a letter or digit. |
A generated ID |
--run <id> |
The run id the lease carries: a name a CI job gives every lease it takes, 1 to 128 letters, digits, ., _ or -, such as 123-1. A gateway passes it to its worker and its admission command. simlock status shows it on the lease line. A bad value exits 2, before the command connects. The SIMLOCK_RUN environment variable sets it when the flag is absent; an empty value is unset. |
SIMLOCK_RUN, else on GitHub Actions $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT (-1 when the attempt is unset), else none |
--label <text> |
A name for the lease, such as feature-x: 1 to 64 characters, none of them a control character. It is display-only: nothing routes or limits by it. simlock status shows it on the lease line after the run id, and every lease read answers it as label. An iOS simulator booted for the lease takes the label as its name before it boots, so with drivers.ios.deviceSet: "default" and ios.simulator.headless: false DeviceHub and Simulator.app show it; the next boot of that simulator for any other lease names it back. A warm simulator granted without a boot keeps its name. On Android and physical devices the label shows on the lease only. A bad value is refused by the daemon with BAD_REQUEST (exit 2). |
None |
--meta <key=value> |
Repeatable. Context for the gateway’s admission command, such as --meta project=checkout-app --meta role=ci. The key is the text before the first =; the value is everything after it. The same key twice keeps the last. At most 16 keys; a key is 1 to 64 characters, a value 0 to 256, and keys and values together at most 2048. A gateway passes it to its admission command only: it is stored nowhere, in no event, and a worker ignores it. A flag with no =, or a bound broken, exits 2. |
None |
--physical |
Lease an enrolled physical device. Cannot be combined with --mode, --image-tag, --baseline or --allow-download. |
Off: simulators and emulators only |
--no-wait |
Fail with NO_CAPACITY (exit 11) instead of waiting in the queue. |
Off |
--detach |
Print the grant and exit. Nothing renews or releases the lease after that. | Off |
--ttl <duration> |
How long the lease lives without a renew. More than lease.maxTtlMs (4h by default) is a BAD_REQUEST. |
lease.defaultTtlMs (15m by default) |
--allow-download |
Allow Simlock to download a missing runtime or system image. downloads.policy can force downloads on (always) or off (never). Has no effect through a gateway. |
Off |
--export-env |
Print the lease’s environment as shell export lines in place of the JSON grant, for eval "$(...)". |
Off |
--bind-pid <pid> |
Release the lease when this process exits, in place of the command’s parent. Positive integer. Ignored with --detach. |
The parent process |
On a slim iOS simulator the command also prints one notice line on stderr, after the grant, that names the slim categories the lease has turned off and the way out: {"notice":"slim: <categories> off; use --except <name> or --mode full"} The categories are the iOS catalog’s slim set minus the --except names the lease kept. The line is absent for a full, Android or physical lease, when --except keeps every category, and when the catalog read fails or takes longer than 2 seconds. It changes neither the grant on stdout nor the exit code, and --detach and --export-env print it too.
Without --detach, the command renews the lease every third of its TTL and releases it on SIGINT, SIGTERM, or when the watched process exits. It exits:
- 0 after it released the lease on request. The same signal or exit while the request still waits in the queue cancels the request and exits 0, with nothing printed on stdout.
- 14 when the daemon ended the lease first (TTL expiry, an operator’s
release, or a device that could not be recovered). Alease-lostline on stderr says why. - 1 with
DAEMON_CONNECTION_LOSTwhen the connection to the daemon on this machine dropped. The lease is not released and stays yours until its deadline; the stderr line names it. With--urlthe command reconnects instead, as Remote mode says.
simlock lease renew
Section titled “simlock lease renew”Push a lease’s deadline out. Use it for a lease taken with --detach. Renewing a lease taken under a different requester identity needs the admin role.
simlock lease renew <lease-id> [--ttl <duration>]| Flag | Meaning | Default |
|---|---|---|
<lease-id> |
The lease to renew. Required. | — |
--ttl <duration> |
The new TTL, up to lease.maxTtlMs. |
The TTL the lease was granted with |
Prints the renewed lease as one JSON line.
simlock release
Section titled “simlock release”Give a lease back. The command returns as soon as the lease ends; the device is cleaned in the background. See Keep a device for a long task.
simlock release <lease-id>simlock release --all [--yes]simlock release --run <id>| Flag | Meaning | Default |
|---|---|---|
<lease-id> |
The lease to release. | — |
--all |
Release every lease on the daemon. Needs the admin role. Asks for confirmation. | Off |
--run <id> |
Release every lease that carries this run id and cancel the lease requests of the run that are still waiting. An agent frees its own; an admin frees every owner’s. It asks for no confirmation. Prints {"leaseIds":[…],"requestIds":[…]}: the leases it released and the requests it cancelled or marked. A request a worker has already taken is listed too but not cancelled: it is released as soon as it is granted, so the caller of that request gets the lease and then a lease-lost. Nothing matching is not an error. On a gateway, a worker that cannot be reached fails the command with WORKER_UNREACHABLE after the others are released. |
— |
--yes |
Skip the confirmation for --all. Required when there is no terminal to ask in. |
Off |
Releasing a lease taken under a different requester identity needs the admin role. A lease ID, --all and --run together are a usage error: give only one.
simlock simctl
Section titled “simlock simctl”Run xcrun simctl against Simlock’s iOS device set. Under drivers.ios.deviceSet simlock (the default), Simlock’s simulators live in their own set, so a bare xcrun simctl does not see them; under default this runs plain xcrun simctl in Xcode’s set. See Run simctl or adb on a device.
simlock simctl [--lease <lease-id>] [--stdin] <simctl-args...>| Flag | Meaning | Default |
|---|---|---|
--lease <lease-id> |
Through a gateway: the lease whose device the command runs against. Must come before the simctl arguments. On a worker it is accepted and ignored. | Through a gateway: your only lease |
--stdin |
Through a gateway: read stdin to its end (Ctrl-D at a terminal) and send it to the command, at most 8,388,608 characters; more is refused with BAD_REQUEST. Must come before the simctl arguments, in either order with --lease. On a worker it is accepted and ignored. |
Off: the command gets empty input and stdin is never read |
<simctl-args...> |
Passed to xcrun simctl as written. |
— |
- Every other argument goes to
simctl,--helpincluded. The command exits withsimctl’s own exit code; a Simlock failure also writes a{"error":...}line to stderr. - On a worker it runs on this machine with your terminal. Through a gateway it runs on the worker that holds the lease, and its output is streamed back.
- Stdin is sent only with
--stdin. Without it the command gets empty input, so a pipe that never closes does not hold it up. - Through a gateway the worker puts the lease’s UDID into a command that leaves the device out: write
simlock --gateway simctl install ./MyApp.app. - Simlock refuses
create,erase,delete,shutdown all,runtime delete, a caller-supplied--setor--profiles, and (through a gateway) a command that names another device such asbooted, withUSAGE(exit 2). Give devices back withsimlock releaseandsimlock cleanup. - On a worker,
SIGINTandSIGTERMsent tosimlockare passed on to the tool, andsimlockwaits for it and exits with its code. Sosimctl io recordVideofinishes its file before the command returns (recordVideofinalizes only onSIGINT, so aSIGTERMis passed to it asSIGINT). - In a terminal, Ctrl-C reaches the tool directly, so
simlockdoes not passSIGINTon a second time. ASIGINTsent tosimlockalone while it runs in a terminal is therefore not passed on; sendSIGTERMinstead.
simlock adb
Section titled “simlock adb”Run adb against Simlock’s adb server, which is where Simlock’s emulators are. See Run simctl or adb on a device.
simlock adb [--lease <lease-id>] [--stdin] <adb-args...>| Flag | Meaning | Default |
|---|---|---|
--lease <lease-id> |
Through a gateway: the lease whose device the command runs against. Must come before the adb arguments. On a worker it is accepted and ignored. | Through a gateway: your only lease |
--stdin |
Through a gateway: read stdin to its end (Ctrl-D at a terminal) and send it to the command, at most 8,388,608 characters; more is refused with BAD_REQUEST. Must come before the adb arguments, in either order with --lease. On a worker it is accepted and ignored. |
Off: the command gets empty input and stdin is never read |
<adb-args...> |
Passed to adb as written. |
— |
- The command exits with
adb’s own exit code. - Through a gateway, stdin is sent only with
--stdin; without it the command gets empty input. - Simlock refuses
adb kill-server,adb disconnect, flags that move adb to another server, and (through a gateway)adb shellwith no command, withUSAGE(exit 2).-s,-t,-dand-eare allowed before the subcommand on a worker. - Through a gateway the worker adds
-s <serial>for an emulator, and refuses-swith another serial,-e,-dand-t. - Signals work as for
simlock simctl: on a workerSIGINTandSIGTERMare passed on toadb, and in a terminal Ctrl-C reachesadbdirectly, so sendSIGTERMto stop it from outside.
simlock rotate
Section titled “simlock rotate”Turn your leased iOS simulator to an orientation, on a worker or through a gateway. Only an iPhone or iPad simulator turns, not a foldable iPhone Duo (use agent-device orientation).
simlock rotate <orientation> [--lease <lease-id>]| Flag | Meaning | Default |
|---|---|---|
<orientation> |
portrait, portrait-upside-down, landscape-left or landscape-right. left, right and upside-down are short for the last three, case and surrounding spaces do not matter, and the underscore spellings (landscape_left) work too. |
— |
--lease <lease-id> |
The lease to turn, before or after the orientation. | Your only lease |
It prints Rotated lease <lease-id> to <orientation>, with the orientation spelled portrait, portrait_upside_down, landscape_left or landscape_right. An orientation Simlock does not know, or several leases without --lease, is a usage error (exit 2). A lease on an Android emulator, a physical device or an Apple TV fails with ROTATION_UNSUPPORTED (exit 12). A simulator that cannot take input right now fails with INPUT_UNAVAILABLE (exit 1); run the command again.
simlock files
Section titled “simlock files”Move files to and from your lease’s folder on its worker, so a build made on this machine can be installed by simlock adb or simlock simctl. It needs --url or SIMLOCK_URL: on the daemon’s own machine the folder is a local folder, and the command exits 2.
simlock files put <file> [--name <name>] [--lease <lease-id>]simlock files get <name> [-o <file>] [--lease <lease-id>]simlock files list [--lease <lease-id>]simlock files rm <name> [--lease <lease-id>]| Flag | Meaning | Default |
|---|---|---|
--name <name> |
The name the file gets in the folder: 1 to 128 letters, digits, ., _ or -, starting with a letter or digit |
The file’s own name |
-o <file> |
Write the downloaded file here, whole or not at all | The file’s bytes go to stdout |
--lease <lease-id> |
The lease whose folder to use | The only lease held by your requester id |
put prints {"lease","name","size"} as one JSON line; list prints the route’s JSON, {"files":[{"name","size"}]}; rm prints nothing. A transfer has no size limit and no total time limit: it ends only when no byte has moved for 60 seconds, with REMOTE_UNREACHABLE (exit 1). The worker’s limits and refusals keep their codes: FILE_TOO_LARGE, LEASE_FILES_FULL, FILE_BUSY, UPLOAD_STALLED, UNKNOWN_LEASE and UNKNOWN_FILE exit 1, INSUFFICIENT_DISK_SPACE exits 12. A missing file or a folder is a usage error (exit 2): upload files one at a time. After simlock files put app-debug.apk, simlock adb install app-debug.apk finds the file, because every command runs with the lease’s folder as its working folder. A simlock simctl or simlock adb that fails after naming a path that exists on this machine prints one notice line on stderr saying the command ran on the worker; for a file it names the simlock files put command that uploads it, for a folder it says a folder cannot be uploaded yet.
simlock tunnel
Section titled “simlock tunnel”While the command runs, connect ports between your machine and a leased Android emulator or phone, or iOS simulator, that sits on another machine (a physical iPhone takes no tunnel): reverse lets the device reach a server on your machine (such as Metro), forward lets your machine reach a port on the device. It talks to the worker or gateway over HTTP, so it needs no daemon on your machine.
simlock tunnel reverse|forward <device-port>[:<caller-port>] | emulator adb[:<caller-port>] [reverse|forward ...] [--lease <lease-id>] [--url <url>]| Flag | Meaning | Default |
|---|---|---|
reverse <device-port>[:<caller-port>] |
Make the device’s localhost:<device-port> reach localhost:<caller-port> on this machine. Both are integers 1 to 65535; the worker accepts device ports from 1024. Repeat the word reverse for up to 8 tunnels, counting forward ones; a caller port may appear once across both. |
The caller port is the device port |
forward <device-port>[:<caller-port>] |
Make localhost:<caller-port> on this machine reach localhost:<device-port> on the device. It adds no adb forward rule. The caller port is 1024 to 65535 and listens on loopback only; the command binds it before it asks the worker for anything. |
The caller port is the device port |
emulator adb[:<caller-port>] |
Let your own adb, and so Android Studio, list the leased Android emulator as a device and drive it: shell, install, Logcat, the debugger and adb reverse. The command runs adb connect 127.0.0.1:<caller-port> itself once the worker confirms, and adb disconnect when it ends. Name it once; adb is the only emulator port. The caller port is 1024 to 65535 and listens on loopback only. A lease on a phone or an iOS simulator is refused with TUNNEL_UNSUPPORTED. |
A free caller port, printed in the line |
--lease <lease-id> |
The lease to reach, 1 to 256 characters. | An agent token’s only lease; an operator token must name one |
--url <url> |
The worker or gateway: https://, or http:// only for 127.0.0.1, [::1] or localhost unless you pass --allow-insecure-http or set SIMLOCK_ALLOW_INSECURE_HTTP=1; the origin only, with no path, query or fragment (a trailing / is fine); at most 2048 characters. A --url that is not, is a usage error. |
SIMLOCK_URL |
--token <secret> |
The bearer token, 1 to 4096 characters. | SIMLOCK_TOKEN |
It prints one line per tunnel, and runs until Ctrl-C or SIGTERM, which close the tunnels and exit 0:
reverse device:8081 -> localhost:8081 (lease lse_3c9a7e10-52b4-4f6d-8e21-b07d4a9c6f35)forward localhost:9222 -> device:9222 (lease lse_3c9a7e10-52b4-4f6d-8e21-b07d4a9c6f35)emulator localhost:5585 -> emulator:adb (lease lse_3c9a7e10-52b4-4f6d-8e21-b07d4a9c6f35)While it runs:
- A reverse tunnel whose caller port has nothing listening writes a warning to stderr, at most once every 10 seconds, and stays open.
- A connection to a forward tunnel waits until the worker confirms the tunnels, and closes if the worker refuses. One to a device port with nothing listening is closed; on an iOS simulator, so is one to a port no process of the lease’s simulator listens on.
- A forward connection the worker closes writes
warning: forward <device-port>: <reason>to stderr, at most once every 10 seconds per tunnel. The tunnel stays open. - Every caller port is closed when the command ends.
For emulator adb:
adb: connected to 127.0.0.1:<caller-port>follows the tunnel’s line.- The command finds
adbon yourPATH, then in$ANDROID_HOME,$ANDROID_SDK_ROOTand the default SDK folder (~/Library/Android/sdk; on Windows%LOCALAPPDATA%\Android\Sdk). - When it cannot connect, it writes a warning to stderr, the tunnel stays open, and you run
adb connect 127.0.0.1:<caller-port>yourself. The warning isadb was not found,adb answered: <adb's first line>(a Play Store image answersfailed to authenticateand showsunauthorized: lease agoogle_apisimage), oradb did not answer in 10 s. adb disconnectgets 2 seconds when the command ends and never changes its exit code.- An emulator connection the worker closes writes
warning: emulator adb: <reason>to stderr, at most once every 10 seconds. The tunnel stays open.
| Exit | When |
|---|---|
| 0 | Ctrl-C or SIGTERM. |
1, TUNNEL_CALLER_PORT_IN_USE |
A forward or emulator caller port is in use, before anything is set up on the device. |
| 1, the refusal’s code | The worker refused, such as TUNNEL_BAD_PORT for a device port below 1024. |
1, TUNNEL_DISCONNECTED |
The connection was lost: 45 seconds with no message or ping, or 90 seconds with no answer to the request. |
| 2 | A missing --url, token or lease, an invalid port, a forward or emulator caller port below 1024, an emulator port other than adb, emulator adb named twice, or a repeated caller port. |
14, TUNNEL_LEASE_ENDED |
The lease ended. |
simlock catalog
Section titled “simlock catalog”Show what you can lease on each platform: the installed OS versions and which one is the default, the models grouped by class with each class’s default model, and, on Android, the installed system images. See Lease a specific model or OS.
simlock catalog [--platform <ios|android>] [--json]| Flag | Meaning | Default |
|---|---|---|
--platform <ios or android> |
Show one platform only. | Both |
--json |
Print one JSON line in place of the text view. | Off |
simlock mcp
Section titled “simlock mcp”Start Simlock’s MCP server on stdin and stdout, for an agent to call. Its tools: MCP tools. Setup: Give your agent the MCP server.
simlock mcpTakes no flags other than the global flags. Stdout carries only MCP messages; diagnostics go to stderr. The server starts the daemon on the first tool call that needs it, and releases its lease when it exits. With --url (or SIMLOCK_URL) and a token, it serves its tools from that farm, starts no daemon, and sends the lease request with the agent’s requester id; without a token it exits 2. A dropped connection is ridden out as in Remote mode, and its notices reach the agent as MCP logging messages.
simlock instructions
Section titled “simlock instructions”Print the rules for using Simlock as one Markdown text: what every agent must do, then agent-device, iOS builds, the simlock CLI and MCP. Paste it into your agent’s instructions. See Connect your coding agent.
simlock instructions [--json]| Flag | Meaning |
|---|---|
--json |
Print one JSON object, {"instructions": "..."}, instead of the text. |
The text is the same on every machine, and the command never contacts a daemon, so it works with no daemon running.
simlock setup
Section titled “simlock setup”Install a small simlock skill into Claude Code and Codex, so every later agent session there knows what Simlock is, checks its setup with simlock whoami and reads the rules with simlock instructions. The skill holds no rules itself, so it stays right after you update Simlock. See Connect your coding agent.
simlock setup [--user | --project] [--tool <claude-code|codex>] [--mcp | --no-mcp] [--json]| Flag | Meaning |
|---|---|
--user |
Install for your user, for every project. The default. |
--project |
Install for the project in the current directory only. |
--tool <claude-code|codex> |
Install for this tool, even when it is not set up on this machine. Without it, setup installs for each tool whose directory (~/.claude, ~/.codex or $CODEX_HOME) exists, and reports the other as skipped. |
--mcp |
Also connect Simlock’s MCP server, by running the tool’s own mcp add command. It follows the scope: claude mcp add -s user or -s project; Codex has user scope only. |
--no-mcp |
Do not connect it, and do not ask. |
--json |
Print the report as one JSON object, {"scope": ..., "tools": [...], "machine": {...}}, and ask nothing. |
In a terminal, setup asks for the scope (Install only for this project (not every project)? [y/N]) and, for each tool it installs, whether to connect the MCP server too. The defaults are the user scope and no MCP. With no terminal, or with --json, it asks nothing and takes the defaults unless a flag says otherwise.
The skill is one file, SKILL.md, in a simlock directory under the tool’s skills directory:
| Tool | User scope | Project scope |
|---|---|---|
| Claude Code | ~/.claude/skills/simlock/ |
.claude/skills/simlock/ |
| Codex | ~/.agents/skills/simlock/ |
.agents/skills/simlock/ |
setup touches nothing outside the simlock directory. Run again, it replaces the directory’s contents. If a file or a symlink sits where the simlock directory goes, it fails with SETUP_REFUSED (exit 2) before writing anything for any tool.
The MCP server is connected with claude mcp add -s user simlock -- simlock mcp (-s project at the project scope) and codex mcp add simlock -- simlock mcp. Codex has no project scope for MCP, so at the project scope --mcp reports skipped for it. A tool that is not on PATH is reported skipped; a command that fails or runs longer than 30 seconds is reported failed, and the command then exits 1 with SETUP_MCP_FAILED after the report.
The report has one skill line per tool and, when MCP was asked for, one mcp line:
claude-code skill wrote /Users/me/.claude/skills/simlockclaude-code mcp connectedcodex skill skipped /Users/me/.agents/skills/simlock (Codex not found here; pass --tool codex to install anyway)machine ios ok, android missing: android-sdkSkill statuses are wrote, replaced and skipped; MCP statuses are connected, already, failed and skipped.
After the skill is installed, setup also runs the checks of simlock doctor (without --fix), starting the daemon if it is not running, and ends the report with a machine line. The line names each platform this machine checks, iOS only on macOS: ok, missing: <prerequisite>[, <prerequisite>] or unavailable: <reason>, joined with , . Doctor’s own lines about what to do go to stderr, as they do for simlock doctor. A missing platform is reported, never a failure: the exit code stays what it was. When the check cannot run (the daemon does not start, or it is a gateway), the line reads not checked: <message>.
With --json, machine is {"summary": "ios ok, android missing: android-sdk", "findings": [...]}, where findings are the doctor findings (empty when the check did not run).
simlock status
Section titled “simlock status”Show the daemon’s health and mode, the Simlock version it runs, its console address, capacity, devices, leases and queue depth. Works for any caller. With an agent token, the leases and waiting requests are only your own. See See what the worker is doing.
The CLI: line below Simlock: is the version of the simlock command you ran, so an upgrade that has not restarted the daemon shows as two different versions. --json carries it as cliVersion.
When the daemon has seen a newer Simlock version on npm, the Simlock: line says so: Simlock: 0.3.0 (0.4.0 available). A daemon learns the newest version at start and every 24 hours after, unless update.check is false.
While an update runs, the line below CLI: reads Updating to <version>: waiting for 2 leases (then installing, restarting). After an update that failed, Last update failed (<stage>): <message> stays until the next update starts or the daemon restarts without one.
A lease that carries a run id (simlock lease --run) shows it on its line: Lease <id>: <requester> on <worker>, run <run id> since …. --json carries it as the lease’s runId.
A lease that carries a label (simlock lease --label) shows it after the run id: Lease <id>: <requester> on <worker>, run <run id>, label <label> since …. --json carries it as the lease’s label.
simlock status [--json]| Flag | Meaning | Default |
|---|---|---|
--json |
Print one JSON line in place of the text view. | Off |
simlock list
Section titled “simlock list”List one kind of record as JSON. Needs the admin role. See See what the worker is doing.
simlock list [--devices|--leases|--rules|--requests]| Flag | Meaning | Default |
|---|---|---|
--devices |
Every device the daemon manages. | Used when no flag is given |
--leases |
Every active lease. | Off |
--rules |
The cleanup rules. | Off |
--requests |
The requests waiting for a device, as text: who asked, for what, how long, and why each waits. | Off |
Only one of the four flags at a time.
simlock events
Section titled “simlock events”Print business events, one JSON line each. Needs the admin role. See the events reference.
simlock events [--follow] [--since <duration>]| Flag | Meaning | Default |
|---|---|---|
--since <duration> |
Read events from this far back, from the history on disk, which survives restarts. | Off: only the recent events the daemon holds in memory (up to eventBuffer.capacity, 1000 by default), which start empty after a restart |
--follow |
Keep printing live events until you press Ctrl-C. With --since, prints the history first, with no gap and no duplicates. |
Off |
--since without --follow reads the history file directly when no daemon is running, and does not start one.
simlock stats
Section titled “simlock stats”Show usage figures for a time window: requests, wait and hold times, provisioning and boot times, capacity and incidents, split by platform, worker and requester. Needs the admin role. See See what the worker is doing.
simlock stats [--since <duration> | --from <ISO> [--to <ISO>]] [--json | --csv]| Flag | Meaning | Default |
|---|---|---|
--since <duration> |
The window ends now and starts this long ago. Cannot be combined with --from. |
24h |
--from <ISO time> |
The window’s start, in ISO 8601 with Z or an offset, such as 2026-10-01T00:00:00Z. |
— |
--to <ISO time> |
The window’s end. Needs --from. |
Now |
--json |
Print one JSON line in place of the text view. | Off |
--csv |
Print every request in the window as CSV, one row each. Cannot be combined with --json. |
Off |
The CSV holds at most the newest requests of the window up to a fixed limit; when it is cut short, a notice line on stderr says so. A window that ends before the oldest figure the history holds fails with HISTORY_NOT_KEPT (exit 12).
simlock whoami
Section titled “simlock whoami”Show the identity your connection has: principal, name, role (admin or agent) and how it was resolved (token, proxy, socket or uplink). See Tokens and roles.
simlock whoami [--json]| Flag | Meaning | Default |
|---|---|---|
--json |
Print one JSON line in place of the text view. | Off |
simlock daemon
Section titled “simlock daemon”Start, stop and inspect the daemon. See Start, stop and update the daemon.
simlock daemon start [--json]simlock daemon stop [--json]simlock daemon status [--json]simlock daemon logs [--follow | --json]simlock daemon install [--json]simlock daemon uninstall [--json]| Subcommand | What it does |
|---|---|
start |
Start the daemon if it is not running, wait until it has finished starting (up to 90 seconds), and print Daemon running with the console address. A start that fails (for example, the HTTP port is taken) exits 1 with DAEMON_STARTUP_FAILED and the daemon’s own error; a daemon still starting after the wait is left running and reported as such. simlock --gateway daemon start creates the gateway on first run. |
stop |
Ask the daemon to stop, wait until it has exited (up to 300 s, then SERVICE_FAILED) and print Daemon stopping. With no daemon running it prints Daemon not running and exits 0. Before it exits the daemon shuts down every idle device it booted; leased devices keep running. Needs the admin role. Never starts a daemon. |
status |
Print the daemon’s status, or Daemon stopped when none is running, then one Service: line: not installed, installed (launchd, <name>), not loaded (launchd, <name>): commands start the daemon without it or broken (launchd, <name>): <path> is gone; run simlock daemon install (<path>, <path> are gone for two). The manager is launchd on macOS, systemd on Linux and task-scheduler on Windows, where not loaded means the user has no desktop session or the task is disabled. Never starts a daemon. Exits 1 when a daemon answers but refuses the connection, with no Service: line. |
logs |
Print the last 100 lines of daemon.log. |
install |
macOS, Linux and Windows only. simlock --gateway daemon install installs the gateway’s own service. A config.json the CLI refuses is a usage error (exit 2) before anything else, so no service is added and a running daemon keeps running. Otherwise stop a running daemon (leases are kept), add a LaunchAgent (macOS), a systemd user unit at $XDG_CONFIG_HOME/systemd/user/<name>.service, else ~/.config/systemd/user/<name>.service (Linux) or a per-user logon task in Task Scheduler (Windows) for this role and start the daemon through it. Prints Service installed: <name> (launchd), (systemd) or (task-scheduler), Daemon running and a hint: To start after a reboot, turn on automatic login for this user. on macOS and Windows, To start after a reboot without logging in, run: loginctl enable-linger <user> on Linux. Without linger the last logout stops the user’s systemd, the daemon and its emulators with it. On another platform it is a usage error: daemon install is supported on macOS, Linux and Windows only. |
uninstall |
Stop a running daemon, unload the LaunchAgent or systemd unit and delete its file, or delete the Windows task. Prints Service removed: <name> (launchd), or Service not installed: <name> when there is none (exit 0). |
| Flag | Meaning | Default |
|---|---|---|
--json |
Print one JSON line in place of the text. start prints {"status":"running"}, stop prints {"status":"stopping"} or {"status":"not-running"}, status prints the status or {"status":"stopped"}, each plus the service object on macOS, logs prints {"logs":"..."}, install prints {"status":"installed","stopped":true,"service":{...}} (stopped only when a daemon was running), uninstall prints {"status":"removed"} or {"status":"not-installed"} plus the same service object. |
Off |
--follow |
logs only: keep printing new lines, across log rotations, until Ctrl-C. Cannot be combined with --json. |
Off |
simlock config
Section titled “simlock config”Read or change the daemon’s configuration. See Change a setting and the configuration reference for every key.
simlock config [--show-secrets]simlock config get <key> [--show-secrets]simlock config set <key> <value>| Subcommand | What it does |
|---|---|
| (none) | Print the daemon’s whole effective configuration as one JSON line. gateway.token, every gateway.headers value and every alert destination’s url and secret read [redacted]. Needs the admin role. |
get <key> |
Print one value, with the same secrets redacted. <key> is a dotted path, such as lease.defaultTtlMs. A key you have not set prints its default, drivers.* keys included; drivers.ios.screenCaptureCommand and drivers.ios.deviceCaptureCommand print only when set, and under drivers.ios.deviceSet: default drivers.ios.deviceRoot has no value (Xcode’s own set uses no device root), so asking for it is a usage error. An unknown key is a usage error. Needs the admin role. |
set <key> <value> |
Write one value to config.json in the daemon’s data folder. <value> is read as JSON when it parses (900000, true, ["ios"]), else as a string. Does not contact the daemon. |
config set checks the whole file after the change and refuses an invalid value or an unknown key with a usage error (exit 2), leaving the file as it was. The file is written with owner-only permissions. A change takes effect the next time the daemon starts; the command prints Updated <key> in <path>; takes effect on daemon restart.
| Flag | Meaning | Default |
|---|---|---|
--show-secrets |
config and config get only: print gateway.token, the gateway.headers values and the alert destinations’ url and secret as written instead of [redacted]. |
Off |
simlock doctor
Section titled “simlock doctor”Check this machine’s prerequisites and compare the daemon’s records with the devices that exist. Findings you must act on go to stderr as text; the full report goes to stdout as one JSON line. See A worker misbehaves.
simlock doctor [--fix] [--purge-orphans] [--yes]| Flag | Meaning | Default |
|---|---|---|
--fix |
Apply the safe corrections to the records. Needs the admin role. Never installs a prerequisite. | Off: report only |
--purge-orphans |
Destroy every orphaned device: a device in Simlock’s device folders with no record. Also destroy every orphan source: a seed simulator with no record, or a saved baseline’s copy that no baseline names. Needs the admin role. Asks for confirmation. | Off |
--yes |
Skip the confirmation for --purge-orphans. Required when there is no terminal to ask in. |
Off |
The report also lists, under sources, the copies on disk that new devices are made from. Each has platform, kind (seed or baseline), model, osVersion, sizeBytes when known, and, for a seed, settled (whether its background settle is done) and leases (how many devices it has made for leases), and staleReason when it no longer matches the installed runtime, or when its iOS simulator was deleted by hand, or when an iOS baseline was saved before simulators stopped sharing folders, or from a lease made before that. A baseline source also has baselineName and baselineVersion. A seed is a simulator Simlock copies to make each iOS simulator a lease gets: it takes disk space but is never leased. A seed with no record, or a baseline copy no baseline names, shows orphan: true. That is not a finding; only --purge-orphans deletes it.
On a worker whose login service names a Node or main.js that is gone, the report holds a service-broken finding and stderr gets Service broken: <name> (<manager>) names missing <path>. Run simlock daemon install again. (<path>, <path> for two).
A gateway refuses doctor with UNSUPPORTED_IN_GATEWAY_MODE (exit 2): run it on each worker.
simlock cleanup
Section titled “simlock cleanup”Run the cleanup rules now, in place of waiting for their next pass. Needs the admin role. See Free disk space.
simlock cleanup [--dry-run] [--rule <name>]| Flag | Meaning | Default |
|---|---|---|
--dry-run |
Print what each rule would do, without doing it. | Off |
--rule <name> |
Run one rule only. simlock list --rules names them. |
Every rule |
A gateway refuses cleanup with UNSUPPORTED_IN_GATEWAY_MODE (exit 2).
simlock update
Section titled “simlock update”Install the newest Simlock, or a named version, on this machine and restart its daemon once the leases it holds have ended. Needs the admin role. See Start, stop and update the daemon.
simlock update [--version <version>] [--force] [--json]| Flag | Meaning | Default |
|---|---|---|
--version <version> |
Install this exact version (0.4.0, 0.4.0-rc.1), older ones included. A tag or a range is a usage error. |
The newest release |
--force |
Do not wait for the leases to end. They survive the restart. | Off |
--json |
Print no progress, only the daemon’s final answer as one JSON line. | Off |
While the daemon waits, it takes no new leases: a request gets DAEMON_UPDATING. Leases already held renew and release as usual. The command follows the update and prints each stage. Ctrl-C stops following and leaves the update running; simlock update --force from another shell stops the wait.
$ simlock updateUpdating simlock 0.3.0 → 0.4.0Waiting for 2 leases to end. Ctrl-C stops following; simlock update --force stops waiting.Installing [email protected]Restarting the daemonsimlock 0.4.0 is running- Already on the newest release:
simlock 0.4.0 is already the latest, and nothing restarts. A prerelease newer than the newest release is not downgraded; name the version to install another. - The install fails:
Update failed (installing): <npm's message>, exit 1. The old daemon keeps running and takes leases again. - The new version does not start: the old version is installed again and started.
Update failed (restarting): <reason>. Rolled back to <version>., exit 1. - The daemon does not answer within 15 minutes after it restarts:
The daemon did not come back; run simlock status., exit 1. - Simlock must be installed with
npm i -g simlock. Otherwise the command stops withUPDATE_UNSUPPORTED_INSTALL. A worker and a gateway of one user share the install, so while the other runs it stops withUPDATE_SHARED_INSTALL. npm failing to find the version isUPDATE_RESOLVE_FAILED. See Errors.
POST /v1/update does the same over HTTP. On a machine that runs a gateway, simlock update --gateway updates the gateway itself. A gateway holds no leases of its own, so it does not wait: it installs and restarts at once, and a request in that gap fails as in any gateway restart. To update a worker from a gateway, use simlock worker update.
simlock nuke
Section titled “simlock nuke”Emergency reset: end every lease, stop the simulators and emulators Simlock started, and clear the queue. Needs the admin role. See Free disk space and reset a machine.
simlock nuke [--delete-devices] [--platform <ios|android>] [--yes]| Flag | Meaning | Default |
|---|---|---|
--delete-devices |
Also delete every device, seed and baseline Simlock manages. | Off |
--platform |
Reset one platform, ios or android: end its leases, stop its devices, and make the warm pool forget its kinds; with --delete-devices it also deletes its devices, seeds and baselines. The other platform is left as it is. Any other value is a usage error. |
Both platforms |
--yes |
Skip the confirmation. Required when there is no terminal to ask in. | Off |
A gateway refuses nuke with UNSUPPORTED_IN_GATEWAY_MODE (exit 2).
simlock seed
Section titled “simlock seed”Make the seed of one kind and settle it, so the first leases of that kind start from a settled copy. Waits until the seed is settled, and prints each stage on stderr. Needs the admin role and runs on a worker; a gateway refuses it with UNSUPPORTED_IN_GATEWAY_MODE (exit 2). See Settle a seed before the first lease.
simlock seed <ios|android> <model> [--os <version|range>] [--image-tag <tag>] [--json]| Argument or flag | Meaning | Default |
|---|---|---|
<ios|android> |
The platform of the kind. | Required |
<model> |
The exact model name, as simlock catalog lists it. |
Required |
--os <version|range> |
The OS version, or a range, as simlock lease --os takes it. |
The newest installed |
--image-tag <tag> |
The Android system image tag. | The default tag |
--json |
Print the answer as one JSON line, and no stage lines. | Off |
$ simlock seed ios "iPhone 17"seed iPhone 17, iOS 26.5: making the seed…seed iPhone 17, iOS 26.5: settling…seed iPhone 17, iOS 26.5: settled in 3m01s (1.7 GiB)A seed that is already settled answers already settled with its size. The --json answer carries platform, model, osVersion, imageTag when the seed has one, sourceId, sizeBytes when known, outcome (settled or already-settled) and settledAfterMs on settled. Ctrl-C stops waiting and exits 0; the settle goes on in the daemon. It never downloads a runtime: a missing one fails with RUNTIME_MISSING, and a failed or 60-minute settle with SEED_SETTLE_FAILED.
simlock warm
Section titled “simlock warm”simlock warm forget
Section titled “simlock warm forget”Forget the kinds the warm pool learned for one model, baseline kinds included, so it stops keeping their devices booted. Use it after a lease of the wrong model. Needs the admin role. See Make leases start faster.
simlock warm forget <ios|android> <model> [<os>] [--mode <slim|full>] [--image-tag <tag>] [--json]| Argument or flag | Meaning | Default |
|---|---|---|
<ios|android> |
The platform of the kind. | Required |
<model> |
The exact model name, as simlock status lists it under warm pool. |
Required |
<os> |
Forget only the kind of this OS version. | Every OS version |
--mode <slim|full> |
Forget only the kind of this mode. | Both modes |
--image-tag <tag> |
Forget only the Android kind with this image tag. | Every tag |
--json |
Print the answer, { "forgotten": [...] }, as one JSON line. |
Off |
$ simlock warm forget android PixelForgot android Pixel 36 (full).Its idle devices are no longer kept warm: the idle rules shut them down and delete them, unless a configured warmPool.targets entry keeps them.When the pool has learned no kind that matches, it prints the kind it was asked for, such as The warm pool has learned no kind matching android Pixel 35 (slim)., and exits 0. A configured warmPool.targets entry is not changed; remove it from the config instead. The next lease of the model teaches the pool its kind again. A gateway refuses warm with UNSUPPORTED_IN_GATEWAY_MODE (exit 2).
simlock component
Section titled “simlock component”Install, list and remove iOS simulator runtimes and Android system images. See Install iOS runtimes and Android images.
simlock component install <ios|android> <version> [--worker <id>... | --all-workers]simlock component list [--platform <ios|android>]simlock component remove <ios|android> <version> [--dry-run] [--yes]simlock component install
Section titled “simlock component install”Install one runtime or system image. Needs the admin role. Progress goes to stderr as JSON lines; the result goes to stdout as one JSON line.
| Flag | Meaning | Default |
|---|---|---|
<ios or android> <version> |
The platform and the version to install, such as ios 18.4 or android 35. Required. |
— |
--worker <id> |
On a gateway: install on this worker. Repeat for more workers. | — |
--all-workers |
On a gateway: install on every worker. Cannot be combined with --worker. |
— |
Without a worker flag the component installs on the machine the daemon runs on, and a gateway refuses with UNSUPPORTED_IN_GATEWAY_MODE. With a worker flag, a worker refuses with UNSUPPORTED_IN_WORKER_MODE. On a gateway, the command exits 15 when any worker did not end installed or already-installed; the per-worker result on stdout says which.
simlock component list
Section titled “simlock component list”List the installed runtimes and system images as one JSON line. Works for any caller.
| Flag | Meaning | Default |
|---|---|---|
--platform <ios or android> |
List one platform only. | Both |
simlock component remove
Section titled “simlock component remove”Remove a runtime or system image that Simlock installed. Needs the admin role.
| Flag | Meaning | Default |
|---|---|---|
<ios or android> <version> |
The component to remove. Required. | — |
--dry-run |
Report what would be removed, without removing it or asking. | Off |
--yes |
Skip the confirmation. Required when there is no terminal to ask in. | Off |
Simlock refuses to remove a component it did not install (COMPONENT_NOT_OWNED) or one a device still uses (COMPONENT_IN_USE). A gateway refuses component list and component remove with UNSUPPORTED_IN_GATEWAY_MODE.
simlock baseline
Section titled “simlock baseline”Save a prepared simulator or emulator as a named baseline, list the baselines on this worker, and remove one. See Save a prepared device.
simlock baseline save <name> --lease <id> [--note <text>]simlock baseline list [--json]simlock baseline remove <name> [--yes] [--worker <id>]simlock baseline save
Section titled “simlock baseline save”Shut the leased simulator or emulator down cleanly, keep a copy of it under the name, end the lease and delete the device. Saving under a name that exists makes the next version and drops the older one. Needs the admin role.
| Argument or flag | Meaning | Default |
|---|---|---|
<name> |
The baseline’s name: 1 to 64 characters of a-z, 0-9, ., _ and -, starting with a letter or digit. Required. |
— |
--lease <id> |
The lease to save. Required; a missing flag is a usage error (exit 2). | — |
--note <text> |
A note of up to 200 characters, on one line. | — |
$ simlock baseline save checkout --lease L1 --note "app 4.2, test user"Saved baseline checkout v1: android Pixel 9, Android 36 (google_apis), full, 4.8 GB. Lease L1 ended.The size is the copy’s bytes on disk, in GB (10^9 bytes) with one decimal, or MB below 1 GB; it is left out when it could not be counted. A lease on a physical device is refused with BAD_REQUEST, an unknown lease with UNKNOWN_LEASE. When the copy cannot be made the lease has still ended and the answer is BASELINE_SAVE_FAILED. On a gateway the lease’s worker saves it.
simlock baseline list
Section titled “simlock baseline list”List the newest version of each baseline, by name. Works for any caller.
| Flag | Meaning | Default |
|---|---|---|
--json |
Print { "baselines": [...] } as one JSON line. |
Off |
$ simlock baseline listNAME VERSION PLATFORM MODEL OS MODE IMAGE SIZE SAVED NOTEcheckout 2 android Pixel 9 36 full google_apis 4.9 GB 2026-11-02 13:40login 1 ios iPhone 17 27.0 slim - 3.1 GB 2026-11-01 09:12 signed in stale: runtime com.apple.CoreSimulator.SimRuntime.iOS-27-0 is not installedA baseline is stale when the runtime, system image or emulator it was made with changed after the save, or when an iOS simulator it was saved as was deleted by hand; the reason is on its own line under the row. The size is - when it could not be counted, and the saved time is the worker’s local time. With none it prints No baselines on this worker. On a gateway it lists every worker’s baselines with the worker’s id in a WORKER column first, and prints No baselines on any worker. for none.
simlock baseline remove
Section titled “simlock baseline remove”Delete every version of a baseline and the idle devices made from it. Needs the admin role.
| Argument or flag | Meaning | Default |
|---|---|---|
<name> |
The baseline to remove. Required. | — |
--yes |
Skip the confirmation. Required when there is no terminal to ask in. | Off |
--worker <id> |
The worker to remove it from. Required on a gateway, which answers BAD_REQUEST and removes nothing without it; a worker refuses it. |
— |
$ simlock baseline remove loginRemove baseline login v1? [y/N] yRemoved baseline login v1.When idle devices were made from it, the line ends with Deleted 2 idle devices made from it. An unknown name is UNKNOWN_BASELINE; a baseline a lease uses is refused with BASELINE_IN_USE and nothing is deleted. A copy that is being cleaned up or held by another operation is refused with DEVICE_BUSY; run the command again once it ends. With --worker wrk_a the prompt and the line end in from wrk_a.
simlock device
Section titled “simlock device”Enrol a physical device plugged into this machine, or forget one. Needs the admin role. See Enrol a phone.
simlock device add --platform <ios|android> <id> [--json]simlock device remove <id> [--json]| Flag | Meaning | Default |
|---|---|---|
<id> |
The device’s ID: the UDID for iOS, the adb serial for Android. Required. | — |
--platform <ios or android> |
add only: which platform the device is. Required for add. |
— |
--json |
Print one JSON line in place of the text line. | Off |
add prints a line such as Enrolled iPhone 15 Pro (iOS 18.4) as 00008110-001A2B3C4D5E, 12 user apps recorded. remove forgets the device and changes nothing on it. A gateway refuses both with UNSUPPORTED_IN_GATEWAY_MODE.
simlock token
Section titled “simlock token”Create, list and revoke the tokens that agents, operators and workers use to connect. Needs the admin role. See Give agents and people access and Add a worker.
simlock token create --role <agent|operator|worker> [--label <text>]simlock token listsimlock token revoke <token-id>| Subcommand | Flag | Meaning | Default |
|---|---|---|---|
create |
--role <agent, operator or worker> |
What the token may do. worker tokens let a worker join a gateway. Required. |
— |
create |
--label <text> |
A name to tell the token apart in token list. Must not be empty. |
None |
revoke |
<token-id> |
The ID token list shows. Required. |
— |
Every subcommand prints one JSON line. create prints the secret once; it cannot be shown again. list prints each token’s id, role, label and createdAt, and for a worker token a worker has joined with, workerId: the id of the worker it is paired with.
simlock worker
Section titled “simlock worker”List the workers of a gateway and take them in and out of service. See Maintain workers.
simlock worker list [--json]simlock worker drain <worker-id>simlock worker undrain <worker-id>simlock worker remove <worker-id>simlock worker update <worker-id> [--version <version>] [--force] [--detach]| Subcommand | What it does |
|---|---|
list |
Show each worker: connection, devices, capacity and installs. A worker’s line also shows its Simlock version, with (<latest> available) when npm has a newer release, and updating to <version>: <stage> while it updates. On a single machine it shows the machine itself. --json prints one JSON line in place of the text view. |
drain |
Stop sending new requests to the worker. Its leases run on. |
undrain |
Send new requests to the worker again. |
remove |
Forget a worker that is not connected. A connected worker is refused with WORKER_CONNECTED: drain it and let it disconnect first. |
update |
Update one worker’s Simlock from the gateway and follow it. The worker takes no new leases while it updates. A drain stays as it is. |
All five need the admin role. drain, undrain and remove print one JSON line, and on a worker all but list fail with UNSUPPORTED_IN_WORKER_MODE (exit 2).
update takes the flags of simlock update and one more:
| Flag | Meaning | Default |
|---|---|---|
--version <version> |
Install this exact version on the worker. | The newest release |
--force |
The worker does not wait for its leases to end. | Off |
--detach |
Print where the update started and return. Follow it with simlock worker list. |
Off |
It follows the worker’s line in the list and ends with one of these:
mac-studio-2 (3f81a2c4) is running 0.4.0Update failed (installing): <message>, exit 1. The worker keeps running its old version and takes leases again.mac-studio-2 (3f81a2c4) is already on the latest (0.4.0).- With
--detach:Updating mac-studio-2 (3f81a2c4) 0.3.0 → 0.4.0. Follow it with simlock worker list.
A worker that shows incompatible can be updated this way too. A worker that is not connected fails with WORKER_NOT_CONNECTED; one that does not answer within 90 seconds fails with the same code. POST /v1/workers/{id}/update does the same over HTTP.
simlock alerts
Section titled “simlock alerts”Send one sample message to one of the gateway’s alert destinations, to check it works. Needs the admin role. See Send alerts.
simlock alerts test <destination> [--json]| Flag | Meaning | Default |
|---|---|---|
<destination> |
The destination’s name in the gateway’s alert configuration. Required. | — |
--json |
Print one JSON line in place of the text line. | Off |
On success it prints Sent a test message to <destination>: HTTP <status>. A name the gateway does not list fails with UNKNOWN_ALERT_DESTINATION (exit 12); a receiver that does not take the message fails with ALERT_SEND_FAILED (exit 1). A worker refuses with UNSUPPORTED_IN_WORKER_MODE.
Output
Section titled “Output”Most output is JSON lines, so agents and scripts can read it.
| Stream | What goes there |
|---|---|
| stdout | The command’s result. JSON by default, one line, for lease, lease renew, release, list, events, cleanup, doctor, nuke, config, config get, token, component, and worker drain, undrain and remove. A text view by default, with --json for one JSON line, for status, catalog, stats, whoami, daemon, worker list, alerts test, device and warm forget. list --requests, config set and lease --export-env print text only. |
| stderr | Progress and notices as JSON lines, and the error line when a command fails. doctor also writes the findings you must act on here as text. |
A lease in progress writes lines like these to stderr:
{"push":"progress","stage":"queued","queuePosition":1}{"push":"progress","stage":"booting","etaMs":60000}{"push":"device-unhealthy","leaseId":"3f6c2a9e-8b1d-4c57-9e0a-5d2b7f41c8e3","deviceId":"7d1e0b52-4a3c-4f8e-b6a9-2c5d8e9f1a04"}{"push":"lease-lost","leaseId":"3f6c2a9e-8b1d-4c57-9e0a-5d2b7f41c8e3","deviceId":"7d1e0b52-4a3c-4f8e-b6a9-2c5d8e9f1a04","reason":"expired"}A failed command writes exactly one error line to stderr:
{"error":{"code":"NO_CAPACITY","message":"No device capacity is currently available"}}code is one of the codes in the errors reference, or USAGE for a bad flag, a missing argument or an unknown command, or INTERNAL for anything unexpected. A usage message for an unknown command or a missing argument ends with (run `simlock --help` for usage).
Durations
Section titled “Durations”Flags that take a duration (--ttl, --timeout, --since) accept a whole number followed by ms, s, m, h or d, such as 90s, 15m or 2d. A number with no unit is milliseconds. Anything else is a usage error.
Exit codes
Section titled “Exit codes”| Exit | Meaning |
|---|---|
| 0 | Success. |
| 1 | The command failed: an internal error, a lost or failed daemon connection, a refused credential, or another failure listed under 1 in the errors reference. |
| 2 | The request was wrong: a usage error, an invalid request, or a command this daemon does not run. |
| 10 | A deadline ran out: the queue wait, a command run on a device, or a download. |
| 11 | Busy: no capacity with --no-wait, or a device or component held by other work. Try again later. |
| 12 | What you asked for does not exist here or cannot be provided: a model, a runtime, a worker, a device. |
| 13 | You already hold a lease, or the lease ID is taken. |
| 14 | lease without --detach: the daemon ended the lease before you did. |
| 15 | component install with --worker or --all-workers: at least one worker did not install. |
| 16 | The gateway’s admission policy refused the request, or could not decide. |
simlock simctl and simlock adb exit with the tool’s own exit code, which can collide with these numbers. Check stderr for an {"error":...} line, which only Simlock writes. The errors reference lists which error code gives which exit code.
Environment variables
Section titled “Environment variables”Read by the CLI and the MCP server
Section titled “Read by the CLI and the MCP server”| Variable | Meaning | Default |
|---|---|---|
SIMLOCK_HOME |
The folder Simlock keeps everything in. The worker uses it directly; a gateway uses its gateway subfolder. A path so long that the daemon’s socket path would pass the system limit fails with USAGE (exit 2). |
~/.simlock |
SIMLOCK_ADMIN_TOKEN |
An admin credential: an operator token or the daemon’s admin.token secret. Used when --token is not given. |
Unset: the CLI reads admin.token |
SIMLOCK_AGENT_ID |
The requester identity: printable, no control characters, at most 256 characters. When set, it wins over the session variables below. | Unset |
SIMLOCK_RUN |
The run id simlock lease gives its lease when --run is not given: 1 to 128 letters, digits, ., _ or -. An empty value is unset; any other bad value exits 2, naming the variable. Without it, on GitHub Actions (GITHUB_ACTIONS is true and GITHUB_RUN_ID is set), the run id is $GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT. |
Unset |
SIMLOCK_URL |
The farm every command runs on, when --url is not given; the same rules as --url. See Remote mode. |
Unset |
SIMLOCK_ALLOW_INSECURE_HTTP |
1 lets a farm URL be http:// to any host, as --allow-insecure-http does; the token then travels unencrypted. Empty counts as unset; any other value is a usage error, and only where a command checks a farm URL. |
Unset |
SIMLOCK_TOKEN |
The bearer token sent to the farm, when --token is not given. |
Unset |
CLAUDE_CODE_SESSION_ID |
Set by Claude Code. Gives the identity claude-code:<id>. |
— |
CODEX_SESSION_ID |
Set by Codex. Gives the identity codex:<id>. |
— |
PI_SESSION_ID |
Set by pi for the commands its bash and powershell tools run. Gives the identity pi:<id>. |
— |
Requester identity
Section titled “Requester identity”Simlock limits leases per requester (one by default, or per platform when the operator sets it), so each agent session needs one stable identity. The CLI uses the first of these:
--agent-id <id>onsimlock lease.SIMLOCK_AGENT_ID, when set.CLAUDE_CODE_SESSION_ID, asclaude-code:<id>, when set and not empty.CODEX_SESSION_ID, ascodex:<id>, when set and not empty.PI_SESSION_ID, aspi:<id>, when set and not empty.- An ID made from the process ID, different for every command.
A requester identity holds no control characters and is at most 256 characters; a request with any other is refused with BAD_REQUEST. Under Claude Code, Codex and pi, every simlock command in one session is the same requester with no setup. simlock mcp resolves the same way, falling back to mcp:<pid>. Codex does not pass CODEX_SESSION_ID to an MCP server, and pi sets PI_SESSION_ID only for its bash and powershell tools, so under Codex and pi the MCP server and the CLI are two requesters and can hold two leases. Elsewhere, set a different SIMLOCK_AGENT_ID for each agent session; a single value shared by several agents makes them one requester with one lease.
Read by a daemon the CLI starts
Section titled “Read by a daemon the CLI starts”A daemon started on demand inherits the environment of the command that started it. Set these in that shell, or restart the daemon after you change them.
| Variable | Meaning |
|---|---|
ANDROID_HOME, ANDROID_SDK_ROOT |
Where the Android SDK is, tried in this order, then ~/Library/Android/sdk (on Windows %LOCALAPPDATA%\Android\Sdk). |
JAVA_HOME |
The JDK the Android SDK tools run on. |
Set in a lease’s environment
Section titled “Set in a lease’s environment”simlock lease --export-env prints these, and the JSON grant carries them under environment. Set them before you run the platform tool directly.
| Variable | When | Meaning |
|---|---|---|
SIMLOCK_IOS_DEVICE_SET |
iOS simulator under simlock (not set under default) |
The device set to pass to xcrun simctl --set. |
SIMLOCK_DEVICE_UDID |
Physical iOS device | The device’s UDID. |
ANDROID_ADB_SERVER_PORT |
Android | The adb server that sees the device: Simlock’s own server for an emulator, 5037 for a physical device. |
ANDROID_SERIAL |
Physical Android device | The device’s adb serial. |