golang/go · error

xcrun simctl launch booted %q: %v

Error message

xcrun simctl launch booted %q: %v

What it means

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.

Source

Thrown at misc/ios/go_ios_exec.go:155

	)
	if out, err := cmd.CombinedOutput(); err != nil {
		os.Stderr.Write(out)
		return fmt.Errorf("xcrun simctl install booted %q: %v", appdir, err)
	}
	return nil
}

func runSimulator(appdir, bundleID string, args []string) error {
	xcrunArgs := []string{"simctl", "spawn",
		"booted",
		appdir + "/gotest",
	}
	xcrunArgs = append(xcrunArgs, args...)
	cmd := exec.Command("xcrun", xcrunArgs...)
	cmd.Stdout, cmd.Stderr = os.Stdout, os.Stderr
	err := cmd.Run()
	if err != nil {
		return fmt.Errorf("xcrun simctl launch booted %q: %v", bundleID, err)
	}

	return nil
}

func copyLocalDir(dst, src string) error {
	if err := os.Mkdir(dst, 0755); err != nil {
		return err
	}

	d, err := os.Open(src)
	if err != nil {
		return err
	}
	defer d.Close()
	fi, err := d.Readdir(-1)
	if err != nil {
		return err

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Ensure installSimulator succeeded before runSimulator in the same booted sim.
  2. Match GOARCH to the simulator host (amd64 sim on Intel Mac, arm64 on Apple Silicon — or enable Rosetta).
  3. Open Simulator.app and watch Console for the crash / dyld error.
  4. Run `xcrun simctl spawn booted <appdir>/gotest` manually to capture the full failure.
Defensive patterns

Strategy: validation

Validate before calling

func appInstalled(appdir string) error {
    // Best-effort: confirm the gotest binary exists in the bundle.
    if _, err := os.Stat(filepath.Join(appdir, "gotest")); err != nil {
        return fmt.Errorf("gotest not in bundle: %w", err)
    }
    return nil
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/976a5d79bb9c9106. Report an issue: GitHub.