Link copied

One day, running git pull suddenly showed:

You have not agreed to the Xcode and Apple SDKs license. You must agree to the license below in order to use Xcode.
Press enter to display the license:

Felt familiar. Here’s what’s going on and how to fix it.

What’s happening?

  • The git that ships with macOS comes from Xcode / Command Line Tools.
    Apple’s toolchain requires you to accept the Xcode and Apple SDKs license before use.

  • When it shows up

    • Right after installing or updating Xcode / CLT
    • After a macOS or Xcode update when a new license hasn’t been accepted
    • The first time you actually hit git after never having accepted

How to fix it

sudo xcodebuild -license
  1. Enter your password
  2. Press Enter to scroll the license
  3. Press Space to reach the end
  4. Type agree and press Enter (screenshot is before agreeing)

Terminal

After that, git works normally again.

Option 2: Accept in one shot (if you don’t read the text)

sudo xcodebuild -license accept

Summary

It popped up out of nowhere — same kind of thing as before. Now it’s documented in one place.

That’s it.