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 do not want install xcode, it's stupid. How can i do


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.

zhanglun avatar Jun 18 '16 05:06 zhanglun

Why should this force an installation of the overbloated xcode instead of xcode command line tools?


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.

tianshuo avatar Jun 22 '16 13:06 tianshuo

I don't think we have any control over the message this prints, it comes out of OSX.

The best resource I've seen on this whole mess is actually from a rails documentation project: http://railsapps.github.io/xcode-command-line-tools.html, it's pretty complete and we'd do well to either link to it or borrow large chunks of it for our own documentation.


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.

rvagg avatar Jun 22 '16 13:06 rvagg

So, I just want to confirm this.

node-gyp has a hard dependency on XCode (the entire IDE) that cannot be fulfilled by CommandLineTools?


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

sw00 avatar Jul 08 '16 09:07 sw00

Yeah, that's whats really strange

tianshuo avatar Jul 08 '16 09:07 tianshuo

no, this is not correct, the commandline tools should be just fine, it's just a matter of wiring up xcode-select to use them by default I think, some kind of OSX magic I don't know off the top of my head


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.

rvagg avatar Jul 08 '16 10:07 rvagg

It Worked! You guys rock. Thanks!

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


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.

carmelocolon avatar Jul 08 '16 15:07 carmelocolon

The first time it failed for me was because I've attempted to install an older version of sqlite: npm install [email protected] --save I then installed the latest version and it went through just fine, no xcode required: npm install [email protected] --save

emkographics avatar Jul 13 '16 03:07 emkographics

I write to confirm @davis ' suggestion, followed by running sudo xcode-select -s /Applications/Xcode.app/Contents/Developer solved it for me.

FYI anyone using a new MacBook or doing a first install of xCode needs to accept the terms/conditions ;)


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.

syntacticsugar avatar Aug 11 '16 14:08 syntacticsugar

@rvagg nice find! I've updated my original post with that link so people who run into this in the future hopefully see that link.

davis avatar Aug 11 '16 23:08 davis

So there is no way to get around this other than installing a 6GB XCode application? Are you kidding me? I don't see the point here.


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

crazyyi avatar Aug 16 '16 06:08 crazyyi

You can try downloading clang from http://llvm.org/releases/download.html but you'll be on your own, it's not a supported configuration.

bnoordhuis avatar Aug 16 '16 07:08 bnoordhuis

Got it, I've solved this problem

chachaxw avatar Sep 15 '16 10:09 chachaxw

Nice! sudo xcode-select -s /Applications/Xcode.app/Contents/Developer It works good for me on Mac OS X El Capitan...


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.

TomCosta avatar Sep 22 '16 18:09 TomCosta

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.


Common Problems:

  • Error: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory is a command line tools instance
  • whether or not you installed XCode beta

Here's all the answers from this thread and links compiled into one.

  1. Install Xcode or Xcode-beta
  2. Initiate Spotlight Search and type Xcode (Note whether you see Xcode, Xcode-beta, Xcode-87...)
  3. CMD+enter to open Xcode's directory
  4. Open Xcode and Accept Terms and Conditions
  5. Move Xcode to /Applications directory ← NOT /Users/{user}/Applications
  6. Open Terminal
    • Xcode-beta: sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
    • Xcode: sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    • Other: Get the proper path to your Xcode app. If yours is Xcode-87, then it would be: sudo xcode-select --switch /Applications/Xcode-87.app/Contents/Developer

Tested on

  • Macbook Pro, El Capitan OS X 10.11.6

bergerjac avatar Oct 23 '16 13:10 bergerjac

I have a simple fix that may be of help when installing Xcode beta for some reason in stays in your downloads folder if you just move it to your application folder that may solve the problem worked for me


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.

allenmabraham avatar Oct 28 '16 15:10 allenmabraham

This is the error when I ran 'ionic build ios' in the terminal. "Error: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance"

I just updated the Xcode a few days ago. My OS is macOS Sierra 10.12.1


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.

bangnguyen77 avatar Oct 31 '16 18:10 bangnguyen77

So there is no way without full XCode installation? I don't want to waste disk space on something I will never use.


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.

vedmant avatar Nov 08 '16 21:11 vedmant

@vedmant unfortunately no


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.

allenmabraham avatar Nov 08 '16 21:11 allenmabraham

@vedmant I just tried, and I am able to build with node-gyp using the Command Line tools instance. I still see these warning messages, but the node-gyp build did work.

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

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

Commands I used were:

  • Install command line tools: xcode-select --install
  • Switch to using (already installed) command line tools: sudo xcode-select --switch /Library/Developer/CommandLineTools
  • Show which version you're currently using: xcode-select -p
    • Mine was /Library/Developer/CommandLineTools

Could you give an example of something that didn't work for you?

gibfahn avatar Nov 09 '16 14:11 gibfahn