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 · 114 comments

Comments

Projects
None yet
@davis
Copy link

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

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

This comment has been minimized.

Copy link

commented Apr 9, 2015

I'm looking for the same answer.

@davis

This comment has been minimized.

Copy link
Author

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented May 21, 2015

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

@Fishrock123 Fishrock123 added the MacOS label Aug 22, 2015

@HectorLS

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Sep 15, 2015

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

@davis

This comment has been minimized.

Copy link
Author

commented Sep 15, 2015

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

@HectorLS

This comment has been minimized.

Copy link

commented Sep 17, 2015

@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

This comment has been minimized.

Copy link

commented Oct 5, 2015

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

@wmertens

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Dec 2, 2015

Agreed with @wmertens

@bnoordhuis

This comment has been minimized.

Copy link
Member

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.

@bnoordhuis bnoordhuis closed this Dec 2, 2015

@firewoof

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Feb 10, 2016

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

@davis

This comment has been minimized.

Copy link
Author

commented Feb 10, 2016

@jesstomo12 your sudo password

@dharmanibc

This comment has been minimized.

Copy link

commented Mar 14, 2016

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

This comment has been minimized.

Copy link
Member

commented Mar 14, 2016

@dharmanibc xcode-select -print-path

@dharmanibc

This comment has been minimized.

Copy link

commented Mar 14, 2016

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Jul 8, 2016

Yeah, that's whats really strange

@rvagg

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

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.

@Sprinter100

This comment has been minimized.

Copy link

commented Dec 15, 2018

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

@voronov007

This comment has been minimized.

Copy link

commented Dec 18, 2018

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

Solved the issue for me

@sumitramteke

This comment has been minimized.

Copy link

commented Dec 19, 2018

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

@BrendanJones44

This comment has been minimized.

Copy link

commented Jan 9, 2019

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

@arnasledev

This comment has been minimized.

Copy link

commented Jan 10, 2019

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

helped for me! mojave.

@reidelliott

This comment has been minimized.

Copy link

commented Jan 16, 2019

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.

This is the ticket, folks.
I'm running macOS 10.14.2.

@zachfeldman

This comment has been minimized.

Copy link

commented Jan 18, 2019

For anyone having an issue where node-gyp is trying to install an older version (older than 3.6.3 roughly), and it keeps failing, and you may think there's an issue with Python or Xcode....use the command in this article to rebuild the native node-gyp:
https://github.com/nodejs/node-gyp/wiki/Updating-npm's-bundled-node-gyp

@mvirbicianskas

This comment has been minimized.

Copy link

commented Feb 8, 2019

@eiTanLaVi helped solve the issue for me!

npm explore npm -g -- npm install node-gyp@latest

@achillesrasquinha

This comment has been minimized.

Copy link

commented Feb 13, 2019

In addition to @jfmercer's perfect answer, make sure you've accepted the license too.

$ sudo xcodebuild -license
@garrettgsb

This comment has been minimized.

Copy link

commented Feb 26, 2019

The solution from @eiTanLaVi worked for me, too 👍 OSX Mojave 10.14.3

npm explore npm -g -- npm install node-gyp@latest

@quenshea

This comment has been minimized.

Copy link

commented Mar 4, 2019

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

love u,it solved my problem perfectly !

@akaRem

This comment has been minimized.

Copy link

commented Mar 11, 2019

For those who come here from google
This also helps in some cases

rm -rf node_modules
rm package-lock.json
npm cache clean
npm install
@jjercx

This comment has been minimized.

Copy link

commented Apr 8, 2019

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.

I solved it using this answer. Thanks! My problem started after I changed Xcode.app name to Xcode 10.1.app inside /applications folder. (I wanted to install multiple Xcode versions at the same time). In that sense, I used sudo xcode-select -s /Applications/Xcode 10.1.app/Contents/Developer to solve my issue

@vrdriver

This comment has been minimized.

Copy link

commented Apr 17, 2019

I have my Xcode living on a different hard drive and so had to run this command in relative to where the other version is, and it worked fine.

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

@mtimofiiv

This comment has been minimized.

Copy link

commented Apr 24, 2019

There's also a GUI way to solve this.

  1. Start Xcode
  2. Go into Preferences -> Locations
  3. Under Command Line Tools, select your Xcode from the dropdown

The above command line ones did not work for me on Mojave 10.14.4 & Xcode 10.2.

@dpnishant

This comment has been minimized.

Copy link

commented May 7, 2019

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer worked for me on macOS Mojave 10.14.4 with node.js 8.10

@hafizzain

This comment has been minimized.

Copy link

commented May 13, 2019

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

Done, Thank you!

@rajm

This comment has been minimized.

Copy link

commented May 29, 2019

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

this fixed the issue for me

@rpaskin

This comment has been minimized.

Copy link

commented Jun 15, 2019

For the record, as @dpnishant commented

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
worked for me on macOS Catalina (Beta) as of today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.