Skip to content

xcodebuild hangs after BUILD SUCCEEDED on Xcode 26.2+ / macOS 26.3 #2768

@rckm

Description

@rckm

Environment

System:
  OS: macOS 26.3
  CPU: (14) arm64 Apple M4 Pro
  Memory: 237.67 MB / 24.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.19.5
    path: /Users/rckm/.nvm/versions/node/v20.19.5/bin/node
  npm:
    version: 10.8.2
    path: /Users/rckm/.nvm/versions/node/v20.19.5/bin/npm
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - iOS 26.2
      - macOS 26.2
IDEs:
  Xcode:
    version: 26.2/17C52
    path: /usr/bin/xcodebuild
Languages:
  Ruby:
    version: 3.4.5
    path: /Users/rckm/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": 18.0.1
  "@react-native-community/cli-platform-apple": 18.0.1
  react: 19.0.0
  react-native: 0.79.1
iOS:
  hermesEnabled: true
  newArchEnabled: true

Description

After updating to macOS 26.3 (Tahoe) with Xcode 26.2 (Build 17C52), react-native run-ios hangs indefinitely after the build succeeds. The xcodebuild process never exits, so the CLI never proceeds to install and launch the app on the simulator.

Building from Xcode IDE (Cmd+R) works fine.

Root Cause

In buildProject.js, the CLI listens for the close event on the spawned xcodebuild process:

buildProcess.on('close', code => { ... });

The close event requires both the process to exit and all stdio streams to close. On Xcode 26.2+, xcodebuild (or its child process SWBBuildService) keeps the pipes open after build completion, so the close event never fires.

Related Issues

Reproducible Demo

Steps to Reproduce

  1. Use macOS 26.3 + Xcode 26.2
  2. Run npx react-native run-ios --verbose
  3. Build completes — ** BUILD SUCCEEDED ** appears in output
  4. CLI hangs indefinitely — never proceeds to app install/launch
  5. No compiler processes running (ps aux | grep clang shows nothing)
  6. xcodebuild process stays alive with SWBBuildService child that has no children of its own

Expected Behavior

After BUILD SUCCEEDED, the CLI should proceed to install and launch the app on the simulator.

Actual Behavior

The CLI hangs forever at BUILD SUCCEEDED. The xcodebuild process and its SWBBuildService child remain alive but idle.

Workaround

Patch @react-native-community/cli-platform-apple buildProject.js to detect BUILD SUCCEEDED in stdout and resolve immediately instead of waiting for the close event:

     const buildProcess = _child_process().default.spawn('xcodebuild', xcodebuildArgs, getProcessOptions(args));
     let buildOutput = '';
+    let buildResolved = false;
     buildProcess.stdout.on('data', data => {
       const stringData = data.toString();
       buildOutput += stringData;
@@ -85,8 +86,22 @@
           loader.start(`Building the app${'.'.repeat(buildOutput.length % 10)}`);
         }
       }
+      // Workaround: xcodebuild on Xcode 26.2+ may hang after build succeeds.
+      // Detect BUILD SUCCEEDED and resolve immediately instead of waiting for close.
+      if (!buildResolved && stringData.includes('BUILD SUCCEEDED')) {
+        buildResolved = true;
+        if (xcodebuildOutputFormatter) {
+          xcodebuildOutputFormatter.stdin.end();
+        } else {
+          loader.stop();
+        }
+        _cliTools().logger.success('Successfully built the app');
+        buildProcess.kill();
+        resolve(buildOutput);
+      }
     });
     buildProcess.on('close', code => {
+      if (buildResolved) return;
       if (xcodebuildOutputFormatter) {

Apply via patch-package:

npx patch-package @react-native-community/cli-platform-apple

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions