12
votes

Git temporarily stopped working after I updated Xcode on my Mac. The message:

"Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo."

and then started working once I'd agreed to Xcode's T&Cs and installed the update.

Why, or should I say how, are the two linked?

I installed Git using the install.

3
Same question here. I was a bit startled when this command: $ git status refused to run and issued this output: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo. I don't even use Xcode (just the command line tools for builds).Matt
You should probably ask Apple this. Unless an XCode dev is on Stackoverflow, I doubt you'll get a conclusive answer.rubenvb
Your git binary is provided by XCode (which is an easy way to get many command line tools). If you don't like this, you can install it manually.Thorbjørn Ravn Andersen
@ThorbjørnRavnAndersen: That'd make sense. The Git manual even recommends that way of installation on a Mac. I can't remember how I installed Git (in 2014) - I would have expected using Homebrew or a separate Git installer. I suspect if I'd used XCode specifically to install Git the message would have made more sense at the time. I see Atlassian recommend using a Git for Mac installer from sourceforge.net/projects/git-osx-installer/files. But I did have XCode installed and clearly that's the link.Anthony
@Anthony Personally I try to stay so close to what Apple thinks I should do as possible (makes many things easier) and the git binary in XCode is "good enough"(TM) for me so the single accept button occasionally is fine with me. Others may have other needs.Thorbjørn Ravn Andersen

3 Answers

6
votes

Your git binary is provided by XCode (which is an easy way to get many command line tools).

If you don't like this, you can install it manually using Homebrew or similar. If you want to compile it yourself you will need a compiler for that. An easy way is using the one provided by XCode (see a pattern here?).

I've found that for my needs as a cross-platform Java-using-git developer the binaries provided by XCode are fine. This especially since they are automatically updated by Apple over time.

4
votes

sudo xcodebuild -license will show you the license text of Xcode.

You have to agree its terms and condition at the end or you can just run the command given below.

sudo xcodebuild -license accept

P.S.- You are giving access to xcode.

0
votes

In your terminal, run your git command as sudo

sudo git status

This will give you the option to view/accept the license agreements. Press enter to view it and press space until you get to the bottom. You can then type "agree" to agree to the license agreements. This will get rid of that message and you can use git again.