0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

xcodebuildコマンドがエラーになる時の対処

Posted at

事象

xcodebuildコマンドが以下のエラーで失敗する。

$ xcodebuild test -project HogePj.xcodeproj -scheme HogePj -destination 'platform=macOS'

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

解決策

以下のIssueの通りに実行。

xcode-select --install # Install Command Line Tools if you haven't already.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

※自分はXcode.appをインストール済みだったのでsudo xcode-select -s /Applications/Xcode.app/Contents/Developerを実行した。Xcode.appがない場合はsudo xcode-select --switch /Library/Developer/CommandLineToolsを実行する必要がありそう。

解説

  • 原因
    • Xcode Command Line ToolsがXCodeを認識できていなかったため、xcodebuildコマンドが正しく動作しなかった
  • Xcode Command Line Toolsとは
    • Appleが提供するCUIツール。makeやxcodebuildなどのコマンド群。
  • Xcode Command Line ToolsにXcodeのパスを明示的に与えることでxcodebuildコマンドが成功するようになる
0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?