Skip to content

A slim iOS lease is slim on every runtime, with one boot #1192

Closed
1 of 1 issue completed
Closed

Description

@V3RON

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 says slim and the log says why. A grant never says full for 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]
Loading

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/ProgramArguments

After:

$ 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.plist where the simulator's service manager keeps which services are turned off, e.g. com.apple.tipsd mapped to true.
  • 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

Completion conditions

  • On a Mac whose newest iOS runtime is 27.0, a slim lease on that runtime is granted slim and 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

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

Completion conditions: all four are delivered by #1196's Done when.

Open work in the same area:

Written by an agent.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    feature:spec
    on Nov 2, 2026
  2. V3RON commented on Nov 2, 2026

    @V3RON
    ContributorAuthor

    Spec updated: added every section (Problem through Tasks), ADR 0060 in PR #1194, and task #1196.

    Written by an agent.

  3. added
    feature:planned
    and removed
    feature:spec
    on Nov 2, 2026
  4. github-actions commented on Nov 2, 2026

    @github-actions
    Contributor

    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.

  5. V3RON commented on Nov 2, 2026

    @V3RON
    ContributorAuthor

    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.slimmed after a failed write that still reads back slim → no event; device.slimmed when 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.

  6. V3RON commented on Nov 2, 2026

    @V3RON
    ContributorAuthor

    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.plist is copied to the new UDID before its first boot (task #1204).

    Written by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:planned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions