node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

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

Open davis opened this issue 11 years ago • 150 comments

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.

davis avatar Jan 28 '15 02:01 davis

nvm install 8.4.2 is installing a version of Node.js that is no longer supported https://nodejs.org/en/about/releases

cclauss avatar Apr 06 '20 16:04 cclauss

I know which version of Xcode is loa

Version 11.4 (11E146) Getting the same error

aakashsingh90 avatar Apr 14 '20 04:04 aakashsingh90

This stack overflow answer pointed me in the right direction. Hope it helps

https://stackoverflow.com/a/17980786

brayhoward avatar Apr 20 '20 16:04 brayhoward

Uninstall the CLT:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

This will reinstall:

image

mrichman avatar Apr 24 '20 11:04 mrichman

Thanks for that! Finally compiling on my computer!

RuichenANCC avatar Apr 27 '20 00:04 RuichenANCC

The issue was solved after updating npm:

npm install -g npm@latest

Biiiiiig thanks !!!

I have solved this problem by upgrading npm from 3.x to 6.x (before I grab all of my hair.)

But one thing weired, I have no Xcode.app directory under /Applications. (just command line tools installed. )

BTW, my system version is macOS Catalina 10.15.4.

Thanks agin.

@msjaber

lpcheniris avatar Apr 28 '20 06:04 lpcheniris

It is not essential to have the XCode App as discussed in solutions 2. and 3.

cclauss avatar Apr 28 '20 06:04 cclauss

I switched from nvm use 8 to nvm use 13. It fixed for me. No xcode related fix was required.

jsbisht avatar May 15 '20 05:05 jsbisht

Uninstall the CLT:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

This will reinstall:

image

This one worked for me on a brand new install of Catalina

robzor avatar Jun 12 '20 17:06 robzor

Tried to do what @robzor did, but I couldn't reinstall via xcode-select --install

Can't install the software because it is not currently available from the software update server

If you have issues with that, try downloading the installer for Command Line Tools for Xcode from: https://developer.apple.com/download/more/

leocaseiro avatar Jun 24 '20 04:06 leocaseiro