Repository navigation
Description
Request: #1049
Problem
From #1049 (point 2), in the reporter's words: "New simulators cannot be slimmed before their first boot. Simlock's slim pass runs /bin/sh inside the simulator, and the iOS 26.5 (23F77), 27.0 (24A434) and 27.1 (24A94425) runtimes installed here have only df and launchctl in RuntimeRoot/bin [...] so on those runtimes a slim lease comes up full (2.4 GB settled on an iPhone 17)."
Two more problems sit on the same step. On a heavily loaded Mac, the in-simulator pass runs out of time part way, and a device can then run with services off while Simlock calls it full (#206). And every simulator Simlock deletes leaves a folder of launchd logs behind in /private/var/tmp (917 MB across 299 folders on one maintainer Mac).
This feature covers #1049's point 2 only. The rest of #1049 (faster new simulators, emulator settings, prepared emulators) is not in it.
Who it is for
An operator who runs many coding agents on one Mac, each leasing a slim iOS simulator, where memory decides how many agents run at once. Today, on current iOS runtimes, they get full simulators while asking for slim ones.
Outcome
- A slim lease on any iOS runtime from 18.5 up gets a slim simulator: its background services are off from its first boot.
- A slim simulator boots once, not twice.
- When Simlock sees after the boot that a slim simulator's services are not off, the grant says
full, and the worker log says why. When it cannot tell, the grant saysslimand the log says why. A grant never saysfullfor a device that runs slim. - A simulator Simlock deletes leaves nothing behind in
/private/var/tmp. - Slim simulators keep Spotlight's dictation service, GameKit and the share sheet service running, as simslim now does, so Spotlight does not leak memory, XCUITest app launches are not delayed and share sheets work.
How it works for the user
flowchart LR
A["simlock lease --mode slim"] --> B{runtime 18.5+?}
B -- no --> F[grant: mode full]
B -- yes --> C[Simlock turns services off<br/>while the simulator is off]
C --> D[one boot]
D --> E{services off?}
E -- yes --> G[grant: mode slim]
E -- no --> H[grant: mode full<br/>log says why]
Before, on an iOS 27.0 runtime (log line as quoted in a #1049 comment, shortened there):
$ simlock lease --device "iPhone 17" --os 27.0 --mode slim --detach --json | jq .device.mode
"full"
$ # worker log
Skipped iOS device slim ... exit 111 ... Invalid or missing Program/ProgramArgumentsAfter:
$ simlock lease --device "iPhone 17" --os 27.0 --mode slim --detach --json | jq .device.mode
"slim"Examples
| Request and device | Today | After |
|---|---|---|
--mode slim, iOS 27.0, runtime without /bin/sh |
full, 1 boot + failed pass |
slim, 1 boot |
--mode slim, iOS 26.4 |
slim, 2 boots |
slim, 1 boot |
--mode slim, iOS 18.4 |
full |
full |
--mode slim, host so loaded a batch times out |
full while services are off |
slim, 1 boot |
--mode slim, runtime ignores the written overrides |
(not reachable) | full, log says why |
--mode slim, re-lease, the file write fails |
(not reachable) | mode the readback shows, log says why |
--mode full |
full |
full, nothing written |
| a slim simulator released and leased again | slim, 2 boots |
slim, 1 boot |
| a simulator deleted by Simlock | folder left in /private/var/tmp |
folder removed |
What could go wrong
- A future Xcode stops reading the overrides file. Slim leases then come up full, with a log line saying why. Likely at some point, since the file is not documented by Apple.
- A slim simulator runs a service a test relied on being off (Spotlight's dictation service, GameKit, the share sheet service). Unlikely to matter: simslim keeps all three on for the reasons above.
- Removing a deleted simulator's folder fails. Nothing breaks; the folder stays, as today.
Words used
- slim simulator: an iOS simulator with background services such as Siri, Spotlight and iCloud turned off to save memory, e.g.
simlock lease --mode slim. - launchd overrides file: the file
/private/var/tmp/com.apple.CoreSimulator.SimDevice.<udid>/disabled.plistwhere the simulator's service manager keeps which services are turned off, e.g.com.apple.tipsdmapped totrue. - readback: after the boot, Simlock asks the simulator which services are off (
launchctl print-disabled system) and compares that with what it wrote.
Non-goals
- Copying a prepared simulator instead of creating one (Named baselines: a lease starts from a device the operator prepared #327).
- Running an operator's own program before a simulator's first boot (Lighter, faster-to-reset devices for a pool of coding agents on one Mac #1049).
- Android (Lighter, faster-to-reset devices for a pool of coding agents on one Mac #1049 points 3 and 4, Lease an Android device that runs as a low-RAM device #484).
- Removing folders left by simulators deleted before this change.
- Falling back to turning services off inside a running simulator.
Completion conditions
- On a Mac whose newest iOS runtime is 27.0, a slim lease on that runtime is granted
slimand every slim service reads as disabled inside the simulator. - A slim simulator released and leased again is still granted
slim, with every slim service disabled. - A slim boot boots the simulator once.
- A simulator Simlock destroys has no folder left in
/private/var/tmp.
Open questions
Decisions
- ADR 0060 — iOS slim writes launchd overrides while the simulator is shut down: the file, the readback and its outcomes, removal on destroy, one boot, and the label list at simslim v0.13.0. Supersedes ADR 0002 §2, §3, §8, §9. Draft in PR docs(adr): 0060 iOS slim writes launchd overrides while the simulator is shut down #1194.
Shared values
none
Behaviours
| Behaviour (invoker, action, what it sees) | Seam | Cases | Task |
|---|---|---|---|
The core prepares a slim device on iOS 18.5+: the overrides file holds every slim label as disabled and every never-disable label as enabled before the one boot, and the device comes back slim with one device.slimmed fact |
IosSimctlDriver.makeReady, src/drivers/ios/index.test.ts |
no file yet; file with the runtime's own entries (kept); file already as wanted (not rewritten, still booted and read back); file slimmed under wider categories (dropped labels now false) |
#1196 |
| The core prepares a slim device and the readback disagrees or fails: the device comes back with the mode the table in ADR 0060 §2 gives and one slim-skipped fact with the reason | IosSimctlDriver.makeReady |
a true label reads enabled or is missing; a true label reads true; a false label missing or reads disabled; readback exits non-zero; readback times out |
#1196 |
| The core prepares a slim device and the file cannot be written: the device still boots, the readback decides its mode as ADR 0060 §2 gives, and a slim-skipped fact says the write failed | IosSimctlDriver.makeReady |
write fails, readback all as wanted (slim); write fails, readback disagrees (full); write fails, readback fails (slim); existing file not a plist dict (left unchanged, readback decides) |
#1196 |
| The core prepares a device that must not be slimmed: the overrides file is not touched | IosSimctlDriver.makeReady |
full mode; purpose: "recover"; runtime 18.4; runtime id that does not parse; configured categories none known |
#1196 |
The core destroys a simulator: its overrides folder is removed after simctl delete, and a failed removal is logged without failing the destroy |
IosSimctlDriver.destroy, destroyLegacy |
removal succeeds; removal fails; simctl delete fails (folder kept, error thrown); destroyLegacy removes it too |
#1196 |
doctor asks for a slim spec's boot estimate: it gets the one-boot estimate |
IosSimctlDriver.estimate |
slim spec; full spec | #1196 |
| The label list: the slim labels and the never-disable labels match simslim v0.13.0 | src/drivers/ios/slim-labels.ts, slim-labels.test.ts |
navd in widgets; assistantd, gamed and sharingd in no category and in the never-disable list |
#1196 |
On a real Mac, a slim lease on the newest installed iOS runtime and a re-lease of the same released simulator are granted slim with every label disabled after one boot |
e2e/slow-ios-slim.test.ts |
cold lease; release then lease again | #1196 |
Tasks
- iOS slim writes the launchd overrides before one boot, reads them back, and destroy removes their folder #1196 — iOS slim writes the overrides file before one boot, reads it back, and destroy removes the folder. Risk: slim leases come up full if the runtime ignores the file.
Completion conditions: all four are delivered by #1196's Done when.
Open work in the same area:
- iOS slim mode stays correct when the host is under load #206 (task:draft, iOS slim under load): its scope is gone with the in-simulator pass. Closed as superseded when iOS slim writes the launchd overrides before one boot, reads them back, and destroy removes their folder #1196 merges; no Depends on.
- Confirm a slim device is actually slim before it is ready #161, Confirm slim mode took effect before granting the lease #152 (confirm a slim device is slim before it is ready): ADR 0060's readback does this for iOS. Their Android and wording parts are theirs; no Depends on.
- Named baselines: a lease starts from a device the operator prepared #327 (named baselines): will copy simulators; a copy must carry the overrides file (
simctl clonedoes not). Noted for its spec; no Depends on. - docs(adr): propose 0055, device remove deletes an idle simulator or emulator (#1131) #1132 (open PR, proposes ADR 0055, device remove deletes an idle simulator): docs only; its design calls the driver's
destroy, so it gets the folder removal. No Depends on. - Every device state change is one device.state-changed event #320 (task:draft, device state-changed event): adds a row to the same
EVENTS.mdtable whosedevice.slimmedrow iOS slim writes the launchd overrides before one boot, reads them back, and destroy removes their folder #1196 edits; a text conflict at most. No Depends on. - feat(agent-device): a worker can keep an idle iOS runner (#1088) #1091 (open PR, a worker can keep an idle iOS runner): agent-device runner, not the slim step. No Depends on.
Written by an agent.
Activity
V3RON commentedon Nov 2, 2026
Spec updated: added every section (Problem through Tasks), ADR 0060 in PR #1194, and task #1196.
Written by an agent.
docs(adr): 0060 iOS slim writes launchd overrides while the simulator…
feat(ios): slim writes launchd overrides before one boot, reads them …
github-actions commentedon Nov 2, 2026
Closing: all 1 sub-issues are closed. The PR that closed the last one walks the completion conditions (delivery rule 9); reopen this if one does not hold on
main. Flip its ADRs to Accepted if delivery has not.V3RON commentedon Nov 2, 2026
Delivery run
Merged: #1194 (ADR 0060), #1197 (#1196)
Parked: none
Waiting: none
Decided: #1196 — recovery boot of a slim simulator → writes nothing, reads nothing back, mode as today;
device.slimmedafter a failed write that still reads back slim → no event;device.slimmedwhen the file is already as wanted → fires (one event per slim boot, as today). All three pending the maintainer, explained on #1194.Written by an agent.
V3RON commentedon Nov 2, 2026
Follow-up: #327 (Named baselines, ADR 0061) builds on this. Every simulator becomes a copy of a booted-once source, and ADR 0060's pre-boot write slims each copy. A baseline's own
disabled.plistis copied to the new UDID before its first boot (task #1204).Written by an agent.