LoginSignup
10

More than 3 years have passed since last update.

【iOS Carthage】Carthage Buildしたら怒られた話し。

Last updated at Posted at 2018-09-01

はじめに

Cartfileに従ってライブラリをインストールしようとcarthage updateを実行したところ、
プロジェクトフォルダのCarthage/Checkoutsにはgithubからクローンしてきたプロジェクトが入ったが、Carthage/Buildにバイナリが入らなかったため、carthage buildを実行してCheckoutsからバイナリを生成しようとしたら怒られた。

$ carthage build
*** xcodebuild output can be found in /var/folders/1p/j83p750s5vg4h2h1f6j_l8yc0000gn/T/carthage-xcodebuild.dVzwMj.log
A shell task (/usr/bin/xcrun xcodebuild -project /Users/rin/Documents/Dev/Swift/PRX/prx-ios-beta/Carthage/Checkouts/Result/Result.xcodeproj CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES -list) failed with exit code 72:
xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

解決までの道のり

エラー内容でググると見つかったこちらの記事の「手順②」に従いXcodeの環境設定上からCommand Line Toolsのバージョンを選択してもなぜか反映されなかった。
スクリーンショット 2018-09-01 12.42.41.png

困っていると、選択欄のすぐ下に2行くらいで「xcode-selectコマンドを使ってコマンドラインからでも変更できるぜ」的なことが書かれているのに気づき、早々にcode-selectでググる。そして下記の記事を参考に

パスを確認してみると、/Library/Developer/CommandLineTools/にインストールされているCommand Line Toolsに向いていたので、

$ xcode-select --print-path
/Library/Developer/CommandLineTools

これをXcodeと一緒にインストールされているCommand Line Toolsに向けると、

$ sudo xcode-select --switch /Applications/Xcode.app
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

下記の画像のように、Xcodeの環境設定上から選択したCommand Line Toolsのバージョンが反映されるようになりました。
スクリーンショット 2018-09-01 13.01.19.png

再度carthage buildを実行すると無事に通った!よかった。

$ carthage build
*** xcodebuild output can be found in /var/folders/1p/j83p750s5vg4h2h1f6j_l8yc0000gn/T/carthage-xcodebuild.qlR0Em.log
*** Building scheme "Result-tvOS" in Result.xcodeproj
*** Building scheme "Result-iOS" in Result.xcodeproj
*** Building scheme "Result-Mac" in Result.xcodeproj
*** Building scheme "Result-watchOS" in Result.xcodeproj
*** Building scheme "APIKit" in APIKit.xcworkspace

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
10