LoginSignup
26
8

More than 3 years have passed since last update.

Macのターミナルで You have not agreed to the Xcode license agreements ... のメッセージが表示されたときの対処法

Last updated at Posted at 2020-04-16

Macのターミナルで gitコマンドを実行したら、以下のメッセージが表示されました。

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

Hit the Return key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

「なんで Xcode ?」
ライセンスに関することが書かれていることは分かりました。
そういえば最近、Xcodeは起動すらしていなかった・・・。

環境

・macOS Catalina 10.15.3

解決方法

まずGoogle翻訳にかけてみました。

Xcodeライセンス契約に同意していません。
Xcodeを使用するには、以下の両方のライセンス契約に同意する必要があります。
Returnキーを押して、
/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf
にあるライセンス契約を表示します。

とのことです。
Enterキーを押すと以下のようなメッセージが表示されます。

Xcode and Apple SDKs Agreement

PLEASE SCROLL DOWN AND READ ALL OF THE FOLLOWING TERMS AND CONDITIONS CAREFULLY BEFORE USING THE APPLE SOFTWARE OR APPLE SERVICES.  THIS IS A LEGAL AGREEMENT BETWEEN YOU AND APPLE.  IF YOU AGREE TO BE BOUND BY ALL OF THE TERMS AND CONDITIONS, CLICK THE “AGREE” BUTTON.  BY CLICKING “AGREE” OR BY DOWNLOADING, USING OR COPYING ANY PART OF THIS APPLE SOFTWARE OR USING ANY PART OF THE APPLE SERVICES, YOU ARE AGREEING ON YOUR OWN BEHALF AND/OR ON BEHALF OF YOUR COMPANY OR ORGANIZATION TO THE TERMS AND CONDITIONS STATED BELOW.  IF YOU DO NOT OR CANNOT AGREE TO THE TERMS OF THIS AGREEMENT, YOU CANNOT USE THIS APPLE SOFTWARE OR THE APPLE SERVICES.  DO NOT DOWNLOAD OR USE THIS APPLE SOFTWARE OR APPLE SERVICES IN THAT CASE.

1.      Definitions
Whenever capitalized in this Agreement:

“Agreement” means this Xcode and Apple SDKs Agreement.

“Apple” means Apple Inc., a California corporation with its principal place of business at One Infinite Loop, Cupertino, California 95014, U.S.A.

“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 services such as the Apple Push Notification Service, In-App Purchase, and iCloud, among other things.

“Apple Maps Service” means the mapping platform and Map Data provided by Apple via the MapKit API (which is the documented API thSoftware License Agreements Press 'space' for more, or 'q' to quit

規約も書かれているので、指示のとおりに下までスクロールすると最後に、
Software License Agreements Press 'space' for more, or 'q' to quit
というメッセージが表示されて、キー入力待ち状態になっていることがわかります。

Spaceキーを押すと、規約の続きが表示されます。
何度かSpaceキーを押していると、最後に以下のメッセージが表示されます。

Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.

Google翻訳にかけると、

Xcode / iOSライセンスに同意するには管理者権限が必要です。
「sudo xcodebuild -license」を実行してから、このコマンドを再試行してください。

とのことなので、指示のとおり実行します。

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 Return key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

「パスワードが間違ってたのかな・・・」
と思いながら、さきほどと同様にEnterキーを押します。

すると、同じような規約が表示されるので、何度かスペースキーを押すと、
最後に、さきほどとは異なるメッセージが表示されました。

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]

指示のとおり、agree と入力してEnterキーを押すと、
以下のメッセージが表示されます。

You can view the license agreements in Xcode's About Box, or at /Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf

Google翻訳にかけると

XcodeのAbout Box、または/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtfでライセンス契約を確認できます。

とのこと。ようやく解決です。
gitコマンドも問題なく実行できることを確認しました。

謝辞

執筆にあたり、こちらを参考にさせていただきました。ありがとうございます。
Macでgitのエラー
macOS High Sierraにしたらgitがエラーしたので解決してみた
[Mac] git コマンドを叩くと、ライセンスに同意するよう要求されたときの対応方法

26
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
8