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

この記事からわかること
- Swift/Carthageでライブラリ導入時に発生したエラーの解決法
- Error:failed with exit code 72:xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH"の原因
- Xcodeの実行パスの変更方法
index
[open]
\ アプリをリリースしました /
環境
- Xcode:14.2
- Carthage:0.39.0
failed with exit code 72:xcrun: error: unable to find utility "xcodebuild", not a developer tool or in PATH
Carthageを使用してライブラリを導入する以下のコマンドを実行した際にエラーが発生しました。
発生したエラー
同時に発生していた「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が指定されていないまたは実行パスがおかしいことで発生するようです。
解決方法
私の場合はターミナルからのXcodeの実行パスを変更することができました。
解決方法
ターミナルからのxcode-selectの実行パスを/Applications/Xcode.app/Contents/Developerに変更する
まずはxcode-select --print-path
コマンドで現在の実行パスを見てみます。私の場合は/Library/Developer/CommandLineTools
になっていました。
なので実行パスを変更する以下のコマンドを実行します。
パスが変更されました・
これで再度実行することで問題なくインストールすることができました。
ご覧いただきありがとうございました。