fix(device): explain a Command Line Tools-only xcode-select instead of asking for a runtime #14640
Closedishaanko(GitHub profile, opens in a new tab)wants to merge 20 commits into
main fromrefs/pull/14640/headopened View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/device/DeviceService.ts line 633Resolvedby ishaanko(GitHub profile, opens in a new tab)@@ -455,5 +457,6 @@455457 hosts.values(),456458 (host) =>457459 Effect.gen(function* () {458- const ready = yield* readinessIfSupported(host.id);459- if (ready) yield* refresh(ready);460+ const summary = yield* host.summary;461+ if (!cannotRunLocally(summary)) {462+ yield* refresh(yield* readiness(host.id));
- apps/server/src/device/LocalDeviceHost.ts lines 123 to 125OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -102,8 +108,18 @@102108 const platformReason = Effect.fn("LocalDeviceHost.platformReason")(function* (103109 platform: DevicePlatform,104-): Effect.fn.Return<string | null, never, FileSystem.FileSystem | Path.Path> {110+): Effect.fn.Return<111+ string | null,112+ never,113+ FileSystem.FileSystem | Path.Path | ProcessRunner.ProcessRunner114+> {105115 const hostPlatform = yield* HostProcessPlatform;106116 if (platform === "ios") {107117 if (hostPlatform !== "darwin") return "iOS Simulators need macOS with Xcode.";108- if (!(yield* isCommandAvailable("xcrun"))) return "Xcode command line tools were not found.";109- return null;118+ const runner = yield* ProcessRunner.ProcessRunner;119+ const simctl = yield* runner120+ .run({ command: "xcrun", args: ["simctl", "help"], timeout: Duration.seconds(15) })121+ .pipe(Effect.result);122+ if (simctl._tag === "Failure") {123+ return simctl.failure._tag === "ProcessSpawnError"124+ ? "Xcode command line tools were not found."125+ : `Could not run xcrun simctl: ${simctl.failure.message}`;
juliusmarminge added labelsmacroscope-review
- apps/server/src/device/LocalDeviceHost.ts lines 138 to 140OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -109,0 +120,21 @@120+ const simctl = yield* runner121+ .run({ command: "xcrun", args: ["simctl", "help"], timeout: Duration.seconds(15) })122+ .pipe(Effect.result);123+ if (simctl._tag === "Failure") {124+ const failure = simctl.failure;125+ return failure._tag === "ProcessSpawnError" &&126+ failure.cause instanceof PlatformError.PlatformError &&127+ failure.cause.reason._tag === "NotFound"128+ ? "Xcode command line tools were not found."129+ : `Could not run xcrun simctl: ${failure.message}`;130+ }131+ const { code, stderr } = simctl.success;132+ if (code === 0) return null;133+ if (stderr.includes('unable to find utility "simctl"')) {134+ // Command Line Tools alone also lack simctl, and then there is no Xcode to select.135+ const applications = yield* (yield* FileSystem.FileSystem)136+ .readDirectory("/Applications")137+ .pipe(Effect.orElseSucceed((): ReadonlyArray<string> => []));138+ return applications.some((name) => /^Xcode.*\.app$/.test(name))139+ ? "xcrun cannot find simctl because xcode-select points at Command Line Tools, not Xcode.app. Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer, adjusting the path if Xcode lives elsewhere, then check again."140+ : "xcrun cannot find simctl because only Command Line Tools are installed. Install Xcode, then check again.";apps/server/src/device/LocalDeviceHost.ts line 138OutdatedResolvedby ishaanko(GitHub profile, opens in a new tab)@@ -109 +119,20 @@109- return null;119+ const runner = yield* ProcessRunner.ProcessRunner;120+ const simctl = yield* runner121+ .run({ command: "xcrun", args: ["simctl", "help"], timeout: Duration.seconds(15) })122+ .pipe(Effect.result);123+ if (simctl._tag === "Failure") {124+ const failure = simctl.failure;125+ return failure._tag === "ProcessSpawnError" &&126+ failure.cause instanceof PlatformError.PlatformError &&127+ failure.cause.reason._tag === "NotFound"128+ ? "Xcode command line tools were not found."129+ : `Could not run xcrun simctl: ${failure.message}`;130+ }131+ const { code, stderr } = simctl.success;132+ if (code === 0) return null;133+ if (stderr.includes('unable to find utility "simctl"')) {134+ // Command Line Tools alone also lack simctl, and then there is no Xcode to select.135+ const applications = yield* (yield* FileSystem.FileSystem)136+ .readDirectory("/Applications")137+ .pipe(Effect.orElseSucceed((): ReadonlyArray<string> => []));138+ return applications.some((name) => /^Xcode.*\.app$/.test(name))
- apps/server/src/device/LocalDeviceHost.ts lines 142 to 142OutdatedResolvedby ishaanko(GitHub profile, opens in a new tab)@@ -109,0 +122,21 @@122+ .pipe(Effect.result);123+ if (simctl._tag === "Failure") {124+ const failure = simctl.failure;125+ return failure._tag === "ProcessSpawnError" &&126+ failure.cause instanceof PlatformError.PlatformError &&127+ failure.cause.reason._tag === "NotFound"128+ ? "Xcode command line tools were not found."129+ : `Could not run xcrun simctl: ${failure.message}`;130+ }131+ const { code, stderr } = simctl.success;132+ if (code === 0) return null;133+ if (stderr.includes('unable to find utility "simctl"')) {134+ // Name the Xcode bundle in /Applications when there is one, such as Xcode-beta.app.135+ // Otherwise Xcode may be missing or live elsewhere, so cover both without a path.136+ const applications = yield* (yield* FileSystem.FileSystem)137+ .readDirectory("/Applications")138+ .pipe(Effect.orElseSucceed((): ReadonlyArray<string> => []));139+ const xcodes = applications.filter((name) => /^Xcode.*\.app$/.test(name));140+ const xcode = xcodes.includes("Xcode.app") ? "Xcode.app" : xcodes.toSorted()[0];141+ return xcode142+ ? `xcrun cannot find simctl because xcode-select points at Command Line Tools, not ${xcode}. Run sudo xcode-select -s /Applications/${xcode}/Contents/Developer, adjusting the path if Xcode lives elsewhere, then check again.`
juliusmarminge assignedjuliusmarminge
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge added labelsbugfix
juliusmarminge added labelspr:gate-failed
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
tanstack-source added labelsbug
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.









macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed