Skip to content

Add xcode_license rule: accept the Xcode license and rerun the command - #12

Merged
stamparm merged 1 commit into
stamparm:masterfrom
LeonFedotov:xcode-license-rule
Oct 1, 2026
Merged

stamparm merged 1 commit into
stamparm:masterfrom
LeonFedotov:xcode-license-rule

Conversation

@LeonFedotov

@LeonFedotov LeonFedotov commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

After an Xcode update, every tool behind the xcrun shims (git, make, clang) refuses to run until the new license is accepted. Current Xcode prints the whole license and ends with:

Agreeing to the Xcode and Apple SDKs license requires admin privileges, please accept the Xcode license as the root user (e.g. 'sudo xcodebuild -license').

Older Xcode prints You have not agreed to the Xcode license agreements, please run 'sudo xcodebuild -license' .... No rule matched either message, so The Bleep had no fix to offer.

Details

  • Matches any command whose output names sudo xcodebuild -license, unless the command already runs under sudo.
  • Suggests sudo xcodebuild -license accept && <command> first, since the license was just printed in full. It also offers sudo xcodebuild -license && <command> for anyone who wants to read the license and type agree. Commands are joined with shell.and_.
  • If the failed command was xcodebuild -license itself, it just adds sudo.
  • Only enabled by default where xcodebuild exists. Listed in the README with the platform-specific rules, and the rule counts are updated.
  • Adds 12 tests in tests/rules/test_xcode_license.py. flake8 passes, and test_readme_claims, test_rule_quality and test_injection all pass.
  • I checked it end to end on macOS/zsh: thebleep --force-command on a stub that prints Xcode's message suggests sudo xcodebuild -license accept && <command>.

One unrelated test also fails locally on a clean master: tests/rules/test_not_on_path.py::TestProjects::test_a_venv_in_the_parent, likely because my virtualenv lives inside the checkout.

🤖 Generated with Claude Code

After an Xcode update git, make and clang refuse to run until the license
is accepted, and the message names 'sudo xcodebuild -license'. The new
xcode_license rule suggests accepting it and running the command again,
and adds sudo when the command was xcodebuild -license itself.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QPakdNTeVS84QHcekDWY76
@stamparm
stamparm merged commit 4fec4eb into stamparm:master Oct 1, 2026
@stamparm

stamparm commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Merged, with a follow-up on top (c0705d4). Thank you for the rule and for the shape of it, which is what landed.

I ran the commands on real macOS runners (Xcode 16.4 / macOS 15 and Xcode 26.6 / macOS 26) with the license reset. Two things differed from the fixtures:

  • git/make/clang do not print the license text. The xcrun shim runs xcodebuild -find with stderr sent to /dev/null, so all that is left is ... failed with exit code 17664 (69 << 8, xcodebuild's status for an unaccepted license) and xcode-select: Failed to locate .... (A warm xcrun cache hides it, which is why git status can still work right after.)
  • xcodebuild -license itself says You have not agreed to the Xcode license agreements. Please run 'sudo xcodebuild -license' from within a Terminal window ..., and -license accept without root says Agreeing to the Xcode and SDK licenses requires admin privileges, please run ‘sudo xcodebuild -license’ .... Neither is the wording the tests used.

The follow-up matches both real forms, drops the interactive second suggestion (sudo xcodebuild -license accept && <cmd> is verified to work), and replaces the fixtures with the captures. The sudo guard, the xcodebuild gate, the bare xcodebuild -license case and the README/CHANGELOG work are yours; you are credited in the CHANGELOG.

@LeonFedotov
LeonFedotov deleted the xcode-license-rule branch October 4, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants