How to accept an Xcode license automatically?

To accept the Xcode License in the CLI, we can run

sudo xcodebuild -license 

Then the console will offer

You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.

Press Enter to view license agreements at '/opt/homebrew-cask/Caskroom/xcode/7.1/Xcode.app/Contents/Resources/English.lproj/License.rtf'

When you press Enter , a license will be displayed on the screen and at the bottom of the screen, a request will appear

Software License Agreements Press "Space" for more or "q" to exit.

By pressing q , we can quickly mark the license as read, then the final invitation will appear

By typing "agree", you agree to the terms of the software license agreements. Type "print" to print them or anything else to cancel, [agree, print, cancel]

By clicking agree , the license was finally accepted.

But the whole process needs human interaction, is there a way to accept the license automatically?

I tried the following commands, nobody is working.

 sudo echo -e "\nq\nagree\n" | sudo xcodebuild -license sudo echo -e "agree" | sudo xcodebuild -license 
+5
source share
1 answer

This requires administrator privileges (so use sudo or run as root), but the xcodebuild -license accept worked for me on Xcode 7.1.

+9
source

Source: https://habr.com/ru/post/1235339/


All Articles