【Swift/Carthage】Error:「failed with exit code 72:xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH」の解決方法!

この記事からわかること

  • Swift/Carthageライブラリ導入時に発生したエラー解決法
  • Errorfailed with exit code 72:xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH"原因
  • Xcode実行パスの変更方法

index

[open]

\ アプリをリリースしました /

みんなの誕生日

友達や家族の誕生日をメモ!通知も届く-みんなの誕生日-

posted withアプリーチ

環境

failed with exit code 72:xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

Carthageを使用してライブラリを導入する以下のコマンドを実行した際にエラーが発生しました。

$ carthage update --platform iOS

発生したエラー

*** Fetching Alamofire
*** Checking out Alamofire at "5.7.1"
*** xcodebuild output can be found in /var/folders/wh/vtp248lx2fs00q111ngnmc2h0000gn/T/carthage-xcodebuild.TwpGpA.log
*** Skipped downloading Alamofire binary due to the error:
	"Bad credentials"
A shell task (/usr/bin/xcrun xcodebuild -workspace /Users/ユーザー名/Desktop/TestCarthage/Carthage/Checkouts/Alamofire/Alamofire.xcworkspace 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

同時に発生していた「Skipped downloading Alamofire binary due to the error:"Bad credentials"」の解決方法は以下を参考にしてください。

エラーの原因

failed with exit code 72:xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATHはCarthageからGitHubを経由してライブラリをインストールする際にターミナルにてXcodeが指定されていないまたは実行パスがおかしいことで発生するようです。


failed with exit code 72:xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH

解決方法

私の場合はターミナルからのXcodeの実行パスを変更することができました。

解決方法

ターミナルからのxcode-selectの実行パスを/Applications/Xcode.app/Contents/Developerに変更する

まずはxcode-select --print-pathコマンドで現在の実行パスを見てみます。私の場合は/Library/Developer/CommandLineToolsになっていました。

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

なので実行パスを変更する以下のコマンドを実行します。

$ sudo xcode-select --switch /Applications/Xcode.app

パスが変更されました・

$ xcode-select --print-path
/Applications/Xcode.app

これで再度実行することで問題なくインストールすることができました。

$ carthage update --platform iOS

ご覧いただきありがとうございました。

searchbox

スポンサー

ProFile

ame

趣味:読書,プログラミング学習,サイト制作,ブログ

IT嫌いを克服するためにITパスを取得しようと勉強してからサイト制作が趣味に変わりました笑
今はCMSを使わずこのサイトを完全自作でサイト運営中〜

New Article

index