Saw the following error when running an npm install
which required node-gyp
... but could be triggered by anything which requires xcode-select
.
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
What is the problem?
Just in case you're using xcode beta:
I was having the same problem in high sierra. running the following command solved it npm explore npm -g -- npm install node-gyp@latest
This problem happens when
xcode-select
developer directory was pointing to/Library/Developer/CommandLineTools
, when a full regular Xcode was required (happens when CLT are installed after Xcode)Solution:
/Applications
directory (NOT/Users/{user}/Applications
).xcode-select
to the Xcode app Developer directory using the following command:sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct.
/Applications/Xcode.app/Contents/Developer
/Applications/Xcode-beta.app/Contents/Developer
because my Xcode name in Application is "Xcode 10",
works.
Xcode->Preferences->Locations->command line tools
Select the option: Xcode 8.x
Simply run
sudo xcode-select -r
which should automatically reset the path.