{"record":{"id":"976a5d79bb9c9106","repo":"golang/go","slug":"xcrun-simctl-launch-booted-q-v","errorCode":null,"errorMessage":"xcrun simctl launch booted %q: %v","messagePattern":"xcrun simctl launch booted %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"misc/ios/go_ios_exec.go","lineNumber":155,"sourceCode":"\t)\n\tif out, err := cmd.CombinedOutput(); err != nil {\n\t\tos.Stderr.Write(out)\n\t\treturn fmt.Errorf(\"xcrun simctl install booted %q: %v\", appdir, err)\n\t}\n\treturn nil\n}\n\nfunc runSimulator(appdir, bundleID string, args []string) error {\n\txcrunArgs := []string{\"simctl\", \"spawn\",\n\t\t\"booted\",\n\t\tappdir + \"/gotest\",\n\t}\n\txcrunArgs = append(xcrunArgs, args...)\n\tcmd := exec.Command(\"xcrun\", xcrunArgs...)\n\tcmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"xcrun simctl launch booted %q: %v\", bundleID, err)\n\t}\n\n\treturn nil\n}\n\nfunc copyLocalDir(dst, src string) error {\n\tif err := os.Mkdir(dst, 0755); err != nil {\n\t\treturn err\n\t}\n\n\td, err := os.Open(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer d.Close()\n\tfi, err := d.Readdir(-1)\n\tif err != nil {\n\t\treturn err","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/misc/ios/go_ios_exec.go#L137-L173","documentation":"Returned by runSimulator (go_ios_exec.go:155) when `xcrun simctl spawn booted <appdir>/gotest ...` fails (cmd.Run non-nil). Despite the message text saying 'launch', the code uses simctl spawn to run the gotest binary inside the booted simulator with the given args; failure means the test process did not run cleanly.","triggerScenarios":"The gotest binary crashed at startup, the bundle ID/app is not installed, the simulator died mid-run, code signing entitlements blocked launch, or the binary architecture does not match the simulator (e.g., arm64 binary on x86_64 sim without Rosetta).","commonSituations":"App not installed before spawn (installSimulator was skipped/failed); GOARCH mismatch (arm64 vs amd64 simulator); missing entitlements; simulator ran out of memory and killed the process; dyld library load failure.","solutions":["Ensure installSimulator succeeded before runSimulator in the same booted sim.","Match GOARCH to the simulator host (amd64 sim on Intel Mac, arm64 on Apple Silicon — or enable Rosetta).","Open Simulator.app and watch Console for the crash / dyld error.","Run `xcrun simctl spawn booted <appdir>/gotest` manually to capture the full failure."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func appInstalled(appdir string) error {\n    // Best-effort: confirm the gotest binary exists in the bundle.\n    if _, err := os.Stat(filepath.Join(appdir, \"gotest\")); err != nil {\n        return fmt.Errorf(\"gotest not in bundle: %w\", err)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always install before run, in the same booted simulator.","Match GOARCH to the simulator (arm64 on Apple Silicon, amd64 on Intel or via Rosetta).","Watch Simulator Console for dyld/entitlement errors when spawn fails."],"tags":["ios","simulator","xcrun","go-test","exec-wrapper","launch"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}