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

For those on Mojave, the following worked for me:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

nick avatar Oct 01 '18 15:10 nick

@skylarweaver This worked for me. THANK YOU.

inklin avatar Oct 04 '18 00:10 inklin

thanks @jalghizzi - your comment on 29 Mar 2016 worked just fine.

anantgoldie avatar Oct 08 '18 14:10 anantgoldie

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.

waldyrious avatar Oct 09 '18 15:10 waldyrious

MacOS 10.13.6: upgrading brew and using node 10 fixed the problem for me

aheissenberger avatar Oct 11 '18 20:10 aheissenberger

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

robophil avatar Oct 17 '18 13:10 robophil

@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.

ruzpuz avatar Oct 25 '18 09:10 ruzpuz

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.

ekampp avatar Nov 09 '18 06:11 ekampp

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.

Also works with fresh install macos 10.14, but has to run sudo xcode-select -r to run it as root - that was needed.

robindirksen1 avatar Nov 09 '18 19:11 robindirksen1

FWIW this error was a "red herring" for me. A simple brew upgrade npm fixed it

jordy25519 avatar Nov 13 '18 21:11 jordy25519

FWIW this error was a "red herring" for me. A simple brew upgrade npm fixed it

This is what I had to do.

ghost avatar Nov 14 '18 01:11 ghost

For users of macOS 10.14 Mojave

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

kheengz avatar Nov 16 '18 19:11 kheengz

To fix this, all I had to do was sudo xcode-select -r This rests to the default command line tools path

TnnsBeast avatar Nov 23 '18 16:11 TnnsBeast

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.

RyanJWilliams avatar Nov 27 '18 12:11 RyanJWilliams

update node-gyp solved for me $ [sudo] npm explore npm -g -- npm install node-gyp@latest

eLBhogi avatar Dec 10 '18 12:12 eLBhogi

@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.

Sprinter100 avatar Dec 15 '18 11:12 Sprinter100

update node-gyp solved for me $ [sudo] npm explore npm -g -- npm install node-gyp@latest

Solved the issue for me

voronov007 avatar Dec 18 '18 10:12 voronov007

if make failed while you do rebuild, try npm audit fix

sumitramteke avatar Dec 19 '18 11:12 sumitramteke

I did actually need to install XCode, and that solved all my problems.

BrendanJones44 avatar Jan 09 '19 00:01 BrendanJones44

update node-gyp solved for me $ [sudo] npm explore npm -g -- npm install node-gyp@latest

helped for me! mojave.

arnasledev avatar Jan 10 '19 11:01 arnasledev