Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
davis opened this issue Jan 28, 2015 · 151 comments

Comments

@davis
Copy link

davis commented Jan 28, 2015

EDITED FOR PEOPLE JUST GETTING HERE

See #569 (comment) and #569 (comment), 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.

@alejandroiglesias
Copy link

I'm looking for the same answer.

@davis
Copy link
Author

davis commented Apr 13, 2015

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

@jfmercer
Copy link

jfmercer commented Apr 21, 2015

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.

@nitinnain
Copy link

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

@HectorLS
Copy link

HectorLS commented Sep 1, 2015

@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

@dbranchini
Copy link

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

@davis
Copy link
Author

davis commented Sep 15, 2015

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

@HectorLS
Copy link

@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

@rachellji
Copy link

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

@wmertens
Copy link

wmertens commented Nov 12, 2015

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.

@micky2be
Copy link

micky2be commented Dec 2, 2015

Agreed with @wmertens

@bnoordhuis
Copy link
Member

bnoordhuis commented Dec 2, 2015

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.

@firewoof
Copy link

firewoof commented Jan 9, 2016

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.

@turibbio
Copy link

turibbio commented Jan 27, 2016

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.

@jesstomo12
Copy link

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

@davis
Copy link
Author

davis commented Feb 10, 2016

@jesstomo12 your sudo password

@dharmanibc
Copy link

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?

@bnoordhuis
Copy link
Member

@dharmanibc xcode-select -print-path

@dharmanibc
Copy link

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!

@jalghizzi
Copy link

jalghizzi commented Mar 29, 2016

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

@zhanglun
Copy link

zhanglun commented Jun 18, 2016

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.

@tianshuo
Copy link

tianshuo commented Jun 22, 2016

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.

@rvagg
Copy link
Member

rvagg commented Jun 22, 2016

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.

@sw00
Copy link

sw00 commented Jul 8, 2016

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.

@tianshuo
Copy link

tianshuo commented Jul 8, 2016

Yeah, that's whats really strange

@rvagg
Copy link
Member

rvagg commented Jul 8, 2016

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.

@carmelocolon
Copy link

carmelocolon commented Jul 8, 2016

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.

@isomorphisms
Copy link

isomorphisms commented Jan 24, 2020

@davis @gibfahn @bergerjac Thank you so much!

@khanhtc1202
Copy link

OS: version 10.14.5 (18F132)
xcode-select: version 2354
Remove and reinstall xcode-select did not resolve this problem on my machine 😭
I installed the latest version of npm too, who else got the same problem with me?

@wilpat
Copy link

wilpat commented Feb 4, 2020

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

Changing Xcode-Beta.app to Xcode.app in the path should remove this error.

@mvirbicianskas
Copy link

for anyone who were not able to resolve by reinstalling the xcode-select, you might want to check node version, I know for sure, that with v9 didn't work for me, had to downgrade to v8, didn't try to bump it up to v10 or v12 though. After changing node version just reinstall again and should be good ✌️

kkeisuke added a commit to kkeisuke/kkeisuke.com that referenced this issue Feb 9, 2020
vuepress 1.3.0
webpack-dev-middleware 削除

node-gyp buildエラー解消
nodejs/node-gyp#569 (comment)
@flekschas
Copy link

Same experience: v8 works while v12 did not.

@ama21n
Copy link

ama21n commented Feb 27, 2020

This is INCORRECT. I am running the latest MacOS Catalina, and the full XCode is required:
$ xcodebuild
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

What is the bloody point of having command line tools that require the full blown near 10GB GUI??

@mdezc
Copy link

mdezc commented Mar 12, 2020

used nvm to install and switch to node version 8.9.3
installed xcode: xcode-select --install
accepted the xcode license sudo xcodebuild -license space space space.. agree
updated npm to latest npm install -g npm@latest
finally both node-gyp rebuild and npm install worked fine 😅

@clarkttfu
Copy link

I just reinstall xcode-select by running

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

Solved the gyp issue for me

Just upgraded MacOS today, together with an xcode update. I guess somehow that upgrade broke xcode command line tools..

@markanthonyuy
Copy link

I'm using the latest MAC OS Catalina v10.15.4 and none of the solutions above worked. For me, I have to download Xcode from the appstore and switch to appropriate node version my site is using and npm install worked!

@appbears
Copy link

I know it looks like silly answer but you may run once XCode app after install by clicking on it (not on terminal).

@iaremarkus
Copy link

I think xcode-select --install attaches itself to the node version you have installed at the time. So if you're using nvm, asdf or similar, the install process will be linked to the current Node version, and will break if you switch to another version.

@u17zl
Copy link

u17zl commented Apr 6, 2020

I just reinstall xcode-select by running

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

Solved the gyp issue for me

It worked on 10.15.4 installing nvm install 8.4.2
Cheers!

@cclauss
Copy link
Contributor

cclauss commented Apr 6, 2020

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

@aakashsingh90
Copy link

aakashsingh90 commented Apr 14, 2020

I know which version of Xcode is loa

Version 11.4 (11E146)
Getting the same error

@brayhoward
Copy link

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

https://stackoverflow.com/a/17980786

@mrichman
Copy link

Uninstall the CLT:

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

This will reinstall:

image

@RuichenANCC
Copy link

Thanks for that! Finally compiling on my computer!

@lpcheniris
Copy link

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

@cclauss
Copy link
Contributor

cclauss commented Apr 28, 2020

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

@jsbisht
Copy link

jsbisht commented May 15, 2020

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

@cclauss cclauss added the gyp: No Xcode or CLT version detected! See: macOS_Catalina.md label May 19, 2020
@robzor
Copy link

robzor commented Jun 12, 2020

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

@leocaseiro
Copy link

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/

@nodejs nodejs locked as resolved and limited conversation to collaborators Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests