at backyard

Color my life with the chaos of trouble.

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory~というエラーができたときの対応法

とあるプロジェクトでyarn installしたとき、node-gyp rebuild周りでエラーが発生した。

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

もうこのエラーメッセージに書いてあるとおりで、

  • Xcodeをインストールする
  • sudo xcode-select -s /Applications/Xcode.app/Contents/Developerを実行してactiveなdeveloper directoryを変更する

という二点をやれば解決できる。 ちょうどxcodeが入っていないmacbook proでの作業だったので、直面した問題だった。

下記のページを参考にした。

github.com