Summary
Since macOS 27, every UnrealBuildTool build of a Mac GAME target fails after all compile and link actions succeed:
ERROR: Failed to finalize the .app with Xcode. Check the log for more information
Result: Failed (OtherCompilationError) (exit code 6)
Editor targets are unaffected (they have no Xcode finalize step). BuildCookRun packaging and plugin host-project Game targets fail the same way. The console only says the scheme pre-action “Touch UBT generated tiles” failed, during ComputePackagePrebuildTargetDependencyGraph, with no reason. Xcode’s own .xcactivitylog (~/Library/Developer/Xcode/DerivedData/WORKSPACE-*/Logs/Build/) has the real error:
Failed to launch task /bin/sh: The operation couldn't be completed. Bad file descriptor
Cause: inside a full build, the UBA local executor (the only local executor in 5.8; -NoUBA does not avoid it) starts the ApplePostBuildSync child so that the xcodebuild it launches (AppleToolChain.cs, FinalizeAppWithXcode, via Utils.RunLocalProcess, which redirects stdout/stderr but not stdin) execs with stdin (fd 0) CLOSED. lsof on the live xcodebuild shows fd 0 reused by a framework file dyld opened later. Under macOS 27, xcodebuild then cannot spawn the scheme’s shell-script pre-action.
Suggested fix: give xcodebuild a valid stdin. Verified workaround in FinalizeAppWithXcode: set StartInfo.RedirectStandardInput = true and call LocalProcess.StandardInput.Close() immediately after Start(), so stdin is valid and already at EOF (like </dev/null). With that, the Game target, plugin host Game targets and BuildCookRun packaging all succeed. A more general fix may belong where UBA spawns non-detoured local processes, so children never inherit a closed fd 0.
What Type of Bug are you experiencing?
Foundation (C++ Tools, Profiling, & Pipeline)
Steps to Reproduce
- On macOS 27 with Xcode 27, build any project’s Mac Game target with the installed UE 5.8.3, e.g. Engine/Build/BatchFiles/Mac/Build.sh PROJECT Mac Development PATH_TO/PROJECT.uproject
- All compile and link actions succeed; the ApplePostBuildSync action then fails at finalize (exit 6).
- Isolated repro without UBT: copy the xcodebuild command UBT prints after “params:” (xcodebuild build -workspace … UE_XCODE_BUILD_MODE=PostBuildSync) and run it from a shell with stdin closed (append 0<&-): BUILD FAILED, exit 65, with the same “Bad file descriptor” in the .xcactivitylog. Run it with </dev/null: BUILD SUCCEEDED.
- Also: RunUBT.sh -Mode=ApplePostBuildSync -Input=…/PostBuildSync_TARGET.json run on its own succeeds. It fails only when run as an action inside a full build.
Expected Result
The Game target build finishes with Result: Succeeded and a finalized, signed .app, as it did on macOS 26 with the same Xcode 27 and UE 5.8.3.
Observed Result
“ERROR: Failed to finalize the .app with Xcode”, Result: Failed (OtherCompilationError), exit 6, on every Game-target build and every packaging run. UBT’s retry pass (with the full environment shown) fails identically. Ruled out by bisection: the extra environment variables UBT sets (TMPDIR into the UBA session dir, DOTNET_*, UBA_DETOURED, PATH), the working directory, piped stdout/stderr, and freshly written inputs. Xcode first-launch, licence and the Metal Toolchain are all in order.
Tested on UE 5.8.3 (launcher build), macOS 27.0.1, Xcode 27.0 (27A266a), Apple Silicon.
Affects Versions
5.8
Platform(s)
Mac
Additional Notes
Side note, found while applying the workaround: rebuilding UnrealBuildTool from the installed engine’s source fails on Apple Silicon Macs without Rosetta, because EpicGames.Horde’s Grpc.Tools 2.59.0 resolves the macosx_x64 protoc (“Bad CPU type in executable”).