当前位置 : 主页 > 网络安全 > 测试自动化 >

如何以自动化方式接受Xcode许可?

来源:互联网 收集:自由互联 发布时间:2021-06-19
为了在CLI中接受 Xcode许可证,我们可以运行 sudo xcodebuild -license 然后控制台会提示 You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode. Hit the En
为了在CLI中接受 Xcode许可证,我们可以运行

sudo xcodebuild -license

然后控制台会提示

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’

按Enter键,屏幕将显示许可证,并在屏幕底部显示提示

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

通过按q,我们可以快速将许可标记为已读,然后显示最终提示

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]

通过同意,许可证最终被接受.

但整个过程需要人的互动,有没有办法自动接受许可?

我尝试了以下命令,没有一个工作.

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

sudo echo -e "agree" | sudo xcodebuild -license
它需要管理员权限才能执行此操作(因此使用sudo或以root身份运行),但命令xcodebuild -license accept在Xcode 7.1上为我工作.
网友评论