LoginSignup
1
1

More than 3 years have passed since last update.

CocoaPodsのXcodeライセンスエラー

Last updated at Posted at 2019-10-12

CocoaPodsで pod install しようとしたら次のようなエラーが発生しました。

❯ pod install --repo-update
Traceback (most recent call last):
    4: from /Path/to/your/project/vendor/bin/pod:29:in `<main>'
    3: from /Path/to/your/project/vendor/bin/pod:29:in `load'
    2: from /Path/to/your/project/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.7.5/bin/pod:55:in `<top (required)>'
    1: from /Path/to/your/project/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.7.5/lib/cocoapods/command.rb:50:in `run'
/Path/to/your/project/vendor/bundle/ruby/2.6.0/gems/cocoapods-1.7.5/lib/cocoapods/command.rb:169:in `verify_xcode_license_approved!': [!] You have not agreed to the Xcode license, which you must do to use CocoaPods. Agree to the license by running: `xcodebuild -license`. (Pod::Informative)
command.rb
def self.verify_xcode_license_approved!
  if `/usr/bin/xcrun clang 2>&1` =~ /license/ && !$?.success?
    raise Informative, 'You have not agreed to the Xcode license, which ' \
      'you must do to use CocoaPods. Agree to the license by running: ' \
      '`xcodebuild -license`.'
  end
end

Xcodeのライセンスに同意していないので怒られているようです。
そういえば最近Xcodeをアップデートしたし、過去にもこんなことがあった気がします。

前提

❯ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.15
BuildVersion:   19A583

❯ xcodebuild -version
Xcode 11.1
Build version 11A1027

Xcodeを起動してライセンスに同意

Xcodeを起動すると、XcodeとiOS SDKのライセンスへ同意を求めるダイアログが表示されます。

スクリーンショット 2019-10-12 6.20.13.png

ライセンスの内容に同意したい場合は Agree をクリックします。

コマンドラインからライセンスに同意

エラーメッセージにも記載されているとおり、 xcodebuild コマンドを使って(Xcodeを起動せずに)ライセンスに同意することもできます。

ライセンスを表示するためEnterキーの入力を求められる
❯ sudo xcodebuild -license
Password:


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 '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'

プロンプトに Enter キーを入力するとビューワーにライセンスが表示されます。

続きを読む場合は Space キー、ビューワーを終了する場合は q キーを入力します。

続きを読む場合はSpaceキー、ビューワーを終了する場合はqキーを入力
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 CONDITI
ONS, 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 ORGAN
IZATION 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 TH
AT 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.

...

“Updates” means bug fixes, updates, upgrades, modifications, enhancements and supplements to the Apple Software or Apple Services, and any new releases or versions thereof.
Software License Agreements Press 'space' for more, or 'q' to quit

ライセンスの内容に同意したい場合は agree を入力します。 print を入力するとライセンスの内容を印刷できます。同意しない場合は cancel を入力します。

ライセンスの内容に同意を求められる
8.7     Entire Agreement; Governing Language
This Agreement constitutes the entire agreement between the parties with respect to the use of the Apple Software and Apple Services licensed hereunder and supersedes all prior understandings regarding such subject matter.  Notwithstanding the foregoing, to the extent that You have entered into the Apple Developer Program License Agreement (PLA) with Apple and are validly licensed by Apple to exercise additional rights, or to use additional features or functionality of the Apple Software or Apple Services under the PLA, You acknowledge and agree that the PLA shall govern Your use of such additional rights and privileges.  No amendment to or modification of this Agreement will be binding unless in writing and signed by Apple.  The parties hereto confirm that they have requested that this Agreement and all related documents be drafted in English.  Les parties ont exigé que le présent contrat et tous les documents connexes soient rédigés en anglais.


EA1647
8/7/2019


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]

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

Xcodeライセンスの内容
You can view the license agreements in Xcode's About Box, or at /Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf

まとめ

XcodeとiOS SDKのライセンスに同意することで無事解決しました :tada:

❯ pod install --repo-update
...
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 4 dependencies from the Podfile and 11 total pods installed.

プロジェクトをXcodeで起動する前にパッケージ依存管理ツールを実行することは結構あると思いますが、それがXcodeのアップデート直後だったりすると今回のようなエラーに出くわします。

この記事が誰かの助けになればうれしいです :smile:


  1. 「About Boxって何?」と思い調べたところ「Macintoshコンピューターにおいてソフトウェアの作成者やバージョン、連絡先などが表示されるウィンドウ」( 英辞郎 on the WEBより )との情報がみつかりました 

1
1
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
1
1