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

I'm looking for the same answer.

alejandroiglesias avatar Apr 09 '15 23:04 alejandroiglesias

@alejandroiglesias, try this: download Xcode from the app store, open it and accept the license/terms agreement, and try whatever you were doing again.


EDIT(gibfahn): Command line tools is fine, you don't need the full Xcode. Just ignore the warning. See here and here for more info.

davis avatar Apr 13 '15 19:04 davis

This fixed it for me:

  1. Install Xcode
  2. Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

See this explanation on SO.


EDIT(gibfahn): Command line tools is fine, you don't need the full Xcode. Just ignore the warning. See here and here for more info.

jfmercer avatar Apr 21 '15 19:04 jfmercer

Same answer as @jfmercer . But if you installed XCode beta, use this command instead: sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer

nitinnain avatar May 21 '15 13:05 nitinnain

@nitinnain if i use your command i get xcode-select: error: invalid developer directory '/Applications/Xcode-Beta.app/Contents/Developer' i have Xcode7 beta 6 :S

HectorLS avatar Sep 01 '15 15:09 HectorLS

@Tibicenas @nitinnain - same here: xcode-select: error: invalid developer directory '/Applications/Xcode-Beta.app/Contents/Developer'

dbranchini avatar Sep 15 '15 13:09 dbranchini

@Tibicenas @dbranchini did either of you try my suggestion?

davis avatar Sep 15 '15 23:09 davis

@davis finally i uninstalled Xcode and re-install and then doing the xcode-select -switch works.. anyway its a weird issue that should be fixed in the next patch

HectorLS avatar Sep 17 '15 07:09 HectorLS

@davis I tried your suggestion, it worked. thanks!

rachellji avatar Oct 05 '15 18:10 rachellji

Is there no way to not use xcodebuild? I don't want to waste 6GB of disk on pointless crap


EDIT(gibfahn): Command line tools is fine, you don't need the full Xcode. Just ignore the warning. See here and here for more info.

wmertens avatar Nov 12 '15 09:11 wmertens

Agreed with @wmertens

micky2be avatar Dec 02 '15 09:12 micky2be

You can maybe circumvent the xcode-specific logic by passing -DOS=mac -f make-linux to node-gyp (check the source) but it's not supported. I'll close the issue.


EDIT(gibfahn): Command line tools is fine, you don't need the full Xcode. Just ignore the warning. See here and here for more info.

bnoordhuis avatar Dec 02 '15 11:12 bnoordhuis

But if you installed XCode beta, use this command instead: sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer hah, it's worked!


EDIT(gibfahn): Command line tools is fine, you don't need the full Xcode. Just ignore the warning. See here and here for more info.

firewoof avatar Jan 09 '16 10:01 firewoof

XCode2: sudo xcode-select -s /Applications/Xcode\ 2.app/Contents/Developer

Pay attention to the "" to escape the space


EDIT(gibfahn): Command line tools is fine, you don't need the full Xcode. Just ignore the warning. See here and here for more info.

turibbio avatar Jan 27 '16 23:01 turibbio

im having this problem what is the password when you do sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

jesstomo12 avatar Feb 10 '16 08:02 jesstomo12

@jesstomo12 your sudo password

davis avatar Feb 10 '16 18:02 davis

I have the same error: "xcode-select: error: invalid developer directory '/Applications/Xcode.app/Contents/Developer'" I also tried: 1. Install Xcode 2. Run sudo xcode-select -s /Applications/Xcode.app/Contents/Developer or Run sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer Nothing works. How I know which version of Xcode is loaded?

dharmanibc avatar Mar 14 '16 06:03 dharmanibc

@dharmanibc xcode-select -print-path

bnoordhuis avatar Mar 14 '16 11:03 bnoordhuis

Thanks! The problem is solved now. Actually, this was an map-error on OS X 10.10, as somehow it checks for some module to be available for 10.11 and which is not available for 10.10. So, simply, I ignored the error msg. The fink seems properly installed. Thanks again!

dharmanibc avatar Mar 14 '16 12:03 dharmanibc

EDIT(gibfahn): Command line tools is fine, you don't need the full Xcode. Just ignore the warning. See here and here for more info.


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:

Install Xcode (get it from https://developer.apple.com/xcode/) if you don't have it yet,

Point xcode-select to the Xcode Developer directory using the following command:

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

Note: Make sure your Xcode app directory is the same as in the address above; most notably, it'll be probably /Applications/Xcode-Beta.app/Contents/Developeror /Applications/Xcode-beta.app/Contents/Developer if you installed beta XCode release instead.

The Source: http://stackoverflow.com/questions/17980759/xcode-select-active-developer-directory-error/17980786#17980786

jalghizzi avatar Mar 29 '16 02:03 jalghizzi