Build, boot, install, and launch an iOS app for leak investigation
bootAndLaunchForLeakInvestigationOrchestrates building, booting a simulator, and launching an iOS app with MallocStackLogging=1 to enable memory leak detection, returning PID and UDID for further analysis.
Instructions
[mg.build] Single-call orchestration that runs xcodebuild build (optional), boots the iOS Simulator, installs the .app, and launches it with MallocStackLogging=1 propagated via SIMCTL_CHILD_*. Required because leaks --outputGraph regressed on macOS 26.x and only works when the target was launched with malloc-stack-logging in its environment. Returns the host PID + simulator UDID + bundle id ready to chain into captureMemgraph. Auto-discovers BUILT_PRODUCTS_DIR, WRAPPER_NAME, EXECUTABLE_NAME, and PRODUCT_BUNDLE_IDENTIFIER from xcodebuild -showBuildSettings -json. Required: scheme and exactly one of workspace or project.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | No | Absolute path to a .xcworkspace. Mutually exclusive with `project`. | |
| project | No | Absolute path to a .xcodeproj. Mutually exclusive with `workspace`. | |
| scheme | Yes | Xcode scheme that builds the iOS application bundle. | |
| configuration | No | xcodebuild configuration. Default "Debug". | Debug |
| bundleId | No | Override the bundle identifier. By default it is discovered from `xcodebuild -showBuildSettings`. | |
| derivedDataPath | No | Custom -derivedDataPath. Useful to avoid collisions when multiple investigations run in parallel. | |
| simulator | No | Pick a simulator by `udid`, by `name` (with optional `os`), or omit to use whichever simulator is currently booted. | |
| envVars | No | Extra env vars to apply to the launched app (propagated via SIMCTL_CHILD_*). Default already includes MallocStackLogging=1. | |
| launchArgs | No | Extra arguments passed to the app on launch. | |
| buildBeforeLaunch | No | Run `xcodebuild build` before installing. Set false when you've already built and want to skip straight to install/launch. | |
| warmupSeconds | No | How long to wait after launch before resolving the host PID. Default 3 seconds. |