From eb3d6e5fe630c4c75c089246532af1d96ae4ea7a Mon Sep 17 00:00:00 2001 From: Argenis Date: Sat, 21 Mar 2026 11:03:07 -0400 Subject: [PATCH] fix(install): use test-compile instead of xcrun for Xcode license detection (#4151) xcrun --show-sdk-path can succeed even when the Xcode/CLT license has not been accepted, so the previous check was ineffective. Replace it with an actual test-compilation of a trivial C file, which reliably triggers the exit-code-69 failure when the license is pending. --- install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 6ea07d39f..46aaa885e 100755 --- a/install.sh +++ b/install.sh @@ -569,12 +569,19 @@ MSG exit 0 fi # Detect un-accepted Xcode/CLT license (causes `cc` to exit 69). - if ! /usr/bin/xcrun --show-sdk-path >/dev/null 2>&1; then - warn "Xcode license has not been accepted. Run:" + # xcrun --show-sdk-path can succeed even without an accepted license, + # so we test-compile a trivial C file which reliably triggers the error. + _xcode_test_file="$(mktemp /tmp/zeroclaw-xcode-check.XXXXXX.c)" + printf 'int main(){return 0;}\n' > "$_xcode_test_file" + if ! cc -x c "$_xcode_test_file" -o /dev/null 2>/dev/null; then + rm -f "$_xcode_test_file" + warn "The C compiler failed. This usually means the Xcode/CLT license" + warn "has not been accepted. Run:" warn " sudo xcodebuild -license accept" warn "then re-run this installer." exit 1 fi + rm -f "$_xcode_test_file" if ! have_cmd git; then warn "git is not available. Install git (e.g., Homebrew) and re-run bootstrap." fi