macOS: Agreeing to the Xcode/iOS license requires admin privileges, please run "sudo xcodebuild -license" and then retry this command
A new Xcode (or CLT) version needs its license accepted before command-line tools run.
You have not agreed to the Xcode license agreementsAgreeing to the Xcode/iOS license requires admin privileges, please run sudo xcodebuild -licenseYou have not agreed to the Xcode license agreements. You must agree to the license below in order to use Xcodexcodebuild: error: The license agreement has not been accepted Meaning
Run sudo xcodebuild -license and agree (press space to scroll, type agree), or accept non-interactively with sudo xcodebuild -license accept. Needed after every Xcode update, including on CI machines.
Common causes
- Xcode freshly installed or updated
- CLT updated via Software Update
- Fresh CI runner
- License accepted for another user/path
- Switched Xcode versions with xcode-select
⚡ Quick fix
sudo xcodebuild -license accept- Interactive:
sudo xcodebuild -license - Verify:
xcodebuild -version
Detailed fix by platform
macOS
sudo xcodebuild -license accept && xcodebuild -version
How to diagnose
- Version — New Xcode?
- Privileges — sudo?
- CI — Automated accept?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Can't install the software because it is not currently available from the Software Update server macOS: xcode-select: error: Can't install the software because it is not currently available from the Software Update server
- Cannot preview in this file SwiftUI Preview: Cannot preview in this file — the preview crashed / failed to build
- Command CodeSign failed Command CodeSign failed with a nonzero exit code (errSecInternalComponent / resource fork, Finder information not allowed)
Most viewed in macOS
- is damaged and can’t be opened macOS: “App” is damaged and can’t be opened. You should move it to the Trash.
- Operation not permitted (macOS privacy) macOS: Operation not permitted — Terminal/app lacks Full Disk Access (TCC privacy protection)
- zsh: command not found: brew macOS: zsh: command not found: brew (Homebrew not on PATH on Apple Silicon)
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026