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
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.
“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 ...
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.
after run 'sudo xcodebuild -license accept' command ,you maybe need to restart your software
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With