Repository navigation
Description
The problem
We run up to about twenty coding agents on one Mac (M5 Max, 128 GB, Xcode 27.1, emulator 37.2.12), each leasing an iPhone simulator or an Android emulator from Simlock for app QA. Four things cost us memory or minutes per lease. Times below were taken while other work kept load averages between 11 and 220, so they spread.
- A new simulator pays a full first boot.
simctl createplus the first boot takes 20-33 s, and a reclaim's erase brings that first boot back (a 16.7-19.7 s boot after an erase). A copy of a simulator that has already booted once boots in 1.5-5 s. - New simulators cannot be slimmed before their first boot. Simlock's slim pass runs
/bin/shinside the simulator, and the iOS 26.5 (23F77), 27.0 (24A434) and 27.1 (24A94425) runtimes installed here have onlydfandlaunchctlinRuntimeRoot/bin(the comment atsrc/drivers/ios/index.ts:1056saw a 27.0 with/bin/sh; ours has none), so on those runtimes a slim lease comes up full (2.4 GB settled on an iPhone 17). Tools such as simslim can switch services off while the simulator is shut down (0.65 GB settled), but Simlock offers no point between creating a device and its first boot to run one. - An emulator's RAM, cores and metrics come from its device profile. The emulator's own
-memory,-coresand-no-metricsflags cannot be set through the config, and RAM and cores decide how many emulators fit on one machine. Adevices.xmlprofile can lower RAM but not cores, and every lease must then name that model. - An emulator's reclaim depends on a snapshot. A reusable emulator is reset by loading its clean-baseline snapshot (one such load hung for 18 minutes here; reported separately); a fresh one boots twice to save that snapshot and is then deleted at release. With fresh emulators we saw 19-21 s per lease, 5.4 GB idle and 4.7 GB of disk per emulator. There is also no way to prepare an emulator once (switch apps and animations off, skip a browser's first run) and keep that state across leases.
Who runs into this
Teams that run many coding agents on one machine, each leasing a device for a short QA pass (lease, install the app, drive it, release), where memory decides how many agents run at once and a slow reset leaves agents waiting.
What you would like to happen
From the outside:
- A new simulator is ready in seconds, not after a first boot, without carrying any earlier lease's data.
- An operator can run a program of their own on a new simulator before its first boot (a slimming step, settings), with failures reported. This could fit Named baselines: a lease starts from a device the operator prepared #327's Named baselines design, though Named baselines: a lease starts from a device the operator prepared #327 rules out Simlock running setup: there it would be a baseline the operator slimmed while it was shut down, which Simlock then copies.
- An operator can set an emulator's guest RAM, cores and usage metrics in the config.
- An emulator can be prepared once (by a program of the operator's) and reset to that state on every lease, quickly and reliably. This could also fit Named baselines: a lease starts from a device the operator prepared #327, whose reclaim returns a device to its baseline, as long as the Android reset does not depend on a snapshot load.
With local patches these came to 9-18 s per new iPhone (0.65-0.73 GB settled; 30-40 s once per model to make the booted-once copy it is cloned from), and 7-16 s per Android lease after the first (35 s once at load 220; 2.1-2.3 GB idle, 1 GB of disk); an emulator's first lease, which prepares it, took 43-81 s.
Anything else
We run local patches for all four. The ones for points 2 and 4 (a program run before a simulator's first boot; emulators booted read-only from a disk prepared once) are on hold, so they don't run ahead of #327. For #327, or any of these, you're welcome to our measurements and the edge cases we found: an erase brings the first-boot setup back, so a clone source must never be erased; a read-only emulator's reclaim is a shutdown (0.6-1.8 s); a prepared disk holds across leases without a snapshot.
Related: #639 / #1041 (gRPC for emulators; #1042 duplicates #639), #327 (named baselines, which overlaps points 1, 2 and 4; there Simlock copies a device the operator prepared and runs no setup itself), #206 (iOS slim under load, which considers writing the overrides while the simulator is shut down), #1047 (a reclaim's snapshot load that hangs without limit) and #1048 (a new emulator making the others wipe).
Activity
ericlitman commentedon Oct 30, 2026
We hit point 2 independently on Simlock 0.4.0 (Xcode 27.2, macOS 27.0.1, Apple silicon). The iOS 26.5 and 27.0 runtime roots here also have only
dfandlaunchctlinRuntimeRoot/bin, so every--mode slimlease loggedSkipped iOS device slim ... exit 111 ... Invalid or missing Program/ProgramArgumentsand was grantedfull.Measurements, iPhone 17 on iOS 27.0, three runs per row. CPU is the device's
launchd_simtree, sampled every second from the lease (or create) until 60 s after the device was ready. Memory issimslim measureonce booted.simlock lease, new device (falls back to full)simlock release, thensimlock leaseagain (erase, boot)simlock lease, new device, withsimslim watch --set <Simlock's device root>runningsimlock release, thensimlock leaseagain, withsimslim watchrunningsimctl create, thensimslim on(overrides written while shut down, one boot)simctl cloneof a slim template that booted once, plus its override fileOne finding that may help whoever picks this up: simslim keeps its overrides in
/private/var/tmp/com.apple.CoreSimulator.SimDevice.<udid>/disabled.plist, outside the device folder, and that file survives thesimctl erasein Simlock's reclaim. After the first slim, a reused device boots slim from the start:watchfound 5 services to touch on the second boot instead of 155. So runningsimslim watchbeside Simlock already brings reused devices to the cost of a freshly slimmed one, with no change to Simlock. It cannot avoid the full first boot of each new device; the copy-from-baseline path in #327 is what removes that.Side note: Simlock's copy of simslim's service list (
slim-labels.ts, from simslim 65bda5b) predates three simslim fixes:gamedkept on (XCUITest launch delays, MobAI-App/simslim#57),assistantdkept on (a Spotlight memory leak, MobAI-App/simslim#59), andnavdmoved intowidgets(MobAI-App/simslim#61).0xdaniell commentedon Oct 30, 2026
Numbers from one more setup: Intel macOS 26.7.1 VM, 8 vCPU, iOS 26.5, Xcode 26.6.
We copy the data folder in
makeReadyby a local patch, and also wait for agent-device's iOS runner there, because a device with no runner takes 20-90 s on its first snapshot. So for an agent, ready means the runner answers, not that the device booted. Neither has a seam today. Android has the same gap: helper APKs not in the clean baseline add 16 s to the first snapshot (17 s against 0.6 s).Written by an agent.
V3RON commentedon Nov 2, 2026
Point 2 of this request (slimming a new simulator before its first boot) is being specified in #1192: Simlock will write the launchd overrides while the simulator is shut down, ported from simslim, instead of running
/bin/shinside it. The other points stay open here.Written by an agent.
github-actions commentedon Nov 2, 2026
Shipped as #1192.
V3RON commentedon Nov 2, 2026
Points 1 and 4 of this request are specified in #327 (planned 2026-11-02, ADR 0061): every new simulator or emulator is a copy of a device that already booted once, an Android reset no longer loads a snapshot into a running emulator or wipes, and an operator can save a prepared device as a named baseline that leases copy. Point 2 is #1192; the pre-boot program is #1202. Point 3 (emulator RAM, cores and metrics in the config) is not taken up yet. This issue stays open until they ship.
Written by an agent.