xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
EDITED FOR PEOPLE JUST GETTING HERE
See https://github.com/nodejs/node-gyp/issues/569#issuecomment-255589932 and https://github.com/nodejs/node-gyp/issues/569#issuecomment-259421050, the warning can just be ignored. Command Line Tools works fine, you do not need the full Xcode.
See https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md, here and here for more info.
Fix:
xcode-select --install # Install Command Line Tools if you haven't already.
sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools
then just ignore the warning.
Alternatively if you want you can use the full Xcode.app (if you have it installed) with:
# Change the path if you installed Xcode somewhere else.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
If your install is failing
There will be other errors nearer the end, almost certainly issues with the module you're trying to install or a dependency. Please report the error to that project.
If that doesn't work
Are you seeing this when you run node-gyp rebuild or npm install? If not then it's nothing to do with node-gyp, raise a bug with the project you're using.
For those on Mojave, the following worked for me:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
@skylarweaver This worked for me. THANK YOU.
thanks @jalghizzi - your comment on 29 Mar 2016 worked just fine.
None of the suggestions above worked for me. It turns out I needed to update npm from 5.6.0 to 6.4.1, which I did with npm i -g npm. After that, running yarn worked correctly and this issue was gone. Indeed, this comment suggests just that, referring to #1370 ("gyp: don't print xcodebuild not found errors"):
Once you update to a version of npm that has a version of node-gyp that has that commit then the warning will go away.
In case it helps, I was setting up a project that required "node": ">=8.0 <10", and had installed it with nvm install 9.
MacOS 10.13.6: upgrading brew and using node 10 fixed the problem for me
I had to update node-gyp and add it as a dev dependency for this to work after selecting xcode command line tool
# Install Command Line Tools if you haven't already.
# Enable command line tools
# update node-gyp
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools
npm i -D node-gyp
@nick Bravo good sir, thank you!
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
In addition to this I had to accept licence agreements. Now I have other issues, but this is not related to this thread.
If you're on the new Mojave beta versions (at least) the trick was to completely reset the xcode-select settings using xcode-select -r.
If you're on the new Mojave beta versions (at least) the trick was to completely reset the
xcode-selectsettings usingxcode-select -r.
Also works with fresh install macos 10.14, but has to run sudo xcode-select -r to run it as root - that was needed.
FWIW this error was a "red herring" for me. A simple brew upgrade npm fixed it
FWIW this error was a "red herring" for me. A simple
brew upgrade npmfixed it
This is what I had to do.
For users of macOS 10.14 Mojave
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
To fix this, all I had to do was sudo xcode-select -r This rests to the default command line tools path
I was losing my mind with this. Updating from npm v5 to npm v6 fixed it, for reasons I'm not entirely sure of. Pretty likely something else was the root cause as surely this package can work with earlier versions of npm.
update node-gyp solved for me $ [sudo] npm explore npm -g -- npm install node-gyp@latest
@eiTanLaVi Thank you. Because of the node-gyp error, package.json and yarn.lock were not updating when I installed new packages. And now everything's ok. No error.
update node-gyp solved for me $ [sudo] npm explore npm -g -- npm install node-gyp@latest
Solved the issue for me
if make failed while you do rebuild, try
npm audit fix
I did actually need to install XCode, and that solved all my problems.
update node-gyp solved for me $ [sudo] npm explore npm -g -- npm install node-gyp@latest
helped for me! mojave.