Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to accept Xcode license in a automation way?

Tags:

xcode

In order to accept the Xcode License in CLI, we can run

sudo xcodebuild -license

Then the console will prompt

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

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

By pressing Enter, the screen will display the license and at the bottom of screen, it prompts

Software License Agreements Press 'space' for more, or 'q' to quit

By pressing q, we can quickly mark the license as read, then the final prompt shows up

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

By pressing agree, the license was finally accepted.

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

I tried the following commands, none is work.

sudo echo -e "\nq\nagree\n" | sudo xcodebuild -license

sudo echo -e "agree" | sudo xcodebuild -license
like image 395
Quanlong Avatar asked Nov 06 '15 06:11

Quanlong


People also ask

How do I agree to Xcode license on Mac?

Show activity on this post. You need to start/open Xcode once to accept the license agreement. Easiest way to run the application is by clicking on the Spotlight icon on top right and just type its name.

What is Xcode agreement?

“Apple Developer Program License Agreement” means a separate agreement that may be entered into between You and Apple regarding the development and submission of Applications to the App Store for approval and digital signing by Apple, development of libraries for iOS, watchOS, iPadOS, and/or tvOS, and the use of Apple ...


2 Answers

It requires admin privileges to do this (so use sudo or run as root), but the command xcodebuild -license accept worked for me on Xcode 7.1.

like image 157
Brad Allred Avatar answered Oct 16 '22 17:10

Brad Allred


after run 'sudo xcodebuild -license accept' command ,you maybe need to restart your software

like image 5
xtyghost Avatar answered Oct 16 '22 17:10

xtyghost