node-gyp: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
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.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 1633
- Comments: 151 (20 by maintainers)
Links to this issue
- macos - How to accept Xcode license? - Ask Different
- Xocde)해결)xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
- Can not install Auto GPT(as well as Baby AGI)...
- Can not install Auto GPT and Baby AGI...
- genstrings Not Working?
- Installing CA Brightside on a clean MacOS X
Commits related to this issue
- gyp: don't print xcodebuild not found errors As node-gyp rebuild doesn't seem to need xcodebuild, we don't need to be printing the error every time GYP is run. Refs: https://github.com/nodejs/node-g... — committed to gibfahn/node-gyp by gibfahn 6 years ago
- gyp: don't print xcodebuild not found errors As node-gyp rebuild doesn't seem to need xcodebuild, we don't need to be printing the error every time GYP is run. PR-URL: https://github.com/nodejs/node... — committed to gibfahn/node-gyp by gibfahn 6 years ago
- gyp: don't print xcodebuild not found errors As node-gyp rebuild doesn't seem to need xcodebuild, we don't need to be printing the error every time GYP is run. PR-URL: https://github.com/nodejs/node... — committed to gibfahn/node-gyp by gibfahn 6 years ago
- Fix bug from `brew install wix/brew/applesimutils` First time I run `brew install wix/brew/applesimutils` I get this error xcode-select: error: tool 'xcodebuild' requires Xcode, but active deve... — committed to TronNatthakorn/AppleSimulatorUtils by TronNatthakorn 6 years ago
- 依存関係更新 vuepress 1.3.0 webpack-dev-middleware 削除 node-gyp buildエラー解消 https://github.com/nodejs/node-gyp/issues/569#issuecomment-567751789 — committed to kkeisuke/kkeisuke.com by kkeisuke 4 years ago
This fixed it for me:
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.
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:
Here’s all the answers from this thread and links compiled into one.
Xcode
(Note whether you seeXcode
,Xcode-beta
,Xcode-87
…)/Applications
directory ← NOT/Users/{user}/Applications
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Xcode-87
, then it would be:sudo xcode-select --switch /Applications/Xcode-87.app/Contents/Developer
Tested on
Same answer as @jfmercer . But if you installed XCode beta, use this command instead:
sudo xcode-select -s /Applications/Xcode-Beta.app/Contents/Developer
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.
For users of macOS 10.14 Mojave
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
update node-gyp solved for me $ [sudo] npm explore npm -g – npm install node-gyp@latest
@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.
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.
For those on Mojave, the following worked for me:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
There’s also a GUI way to solve this.
The above command line ones did not work for me on Mojave 10.14.4 & Xcode 10.2.
After the latest High Sierra Command Line Tools update for Xcode 10.0, I needed to uninstall my command line tool:
$ rm -rf /Library/Developer/CommandLineTools
Then reinstall them using the commands at the top of this forum. Researched for hours and that’s all I could find that would fix my issue. I also don’t have Xcode installed.
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.
You just need to configure
xcode
after installation: Open your xcode > go topreferences
> selectlocations tab
> selectcommand line tools
> set latest xcode version.The issue was solved after updating npm:
npm install -g npm@latest
I just reinstall xcode-select by running
Solved the gyp issue for me
@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.
Commands I used were:
xcode-select --install
sudo xcode-select --switch /Library/Developer/CommandLineTools
xcode-select -p
/Library/Developer/CommandLineTools
Could you give an example of something that didn’t work for you?
Hi, This work for me:
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
Try
sudo xcode-select -r
. This command worked for me.@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
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.
@dharmanibc
xcode-select -print-path
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.
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:
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
helped for me! mojave.
To fix this, all I had to do was sudo xcode-select -r This rests to the default command line tools path
im having this problem what is the password when you do sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
@jesstomo12 your sudo password
This is frustrating to say the least, we are in 2017 and still this error showing up. I have gcc installed from Homebrew. I do not need Xcode command line tools.
EDIT(gibfahn): Homebrew requires the Xcode Command Line tools.
Agreed with @wmertens
@Tibicenas @nitinnain - same here: xcode-select: error: invalid developer directory ‘/Applications/Xcode-Beta.app/Contents/Developer’
@npny’s digging is right on the money. Here’s the relevant
node-gyp
issue.Xcode Command Line Tools v10.0 (mine landed on my box Sep 17) appears to be incompatible with
node-gyp@3.6.2
, used bynode@8.11.2
. I bumped tonode@8.12.0
(latest LTS), which pullsnode-gyp
up to3.8.0
.npm rebuild <your-busted-package-here>
works again \o/you can always do a
xcode-select -r
if you already have command line tools or Xcode already installed.Uninstall the CLT:
This will reinstall:
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.
used nvm to install and switch to node version 8.9.3 installed xcode:
xcode-select --install
accepted the xcode licensesudo xcodebuild -license
space space space… agree updated npm to latestnpm install -g npm@latest
finally bothnode-gyp rebuild
andnpm install
worked fine 😅sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
worked for me onmacOS Mojave 10.14.4
withnode.js 8.10
This is the ticket, folks. I’m running macOS 10.14.2.
Solved the issue for me
@patrickcat when I try to run
sudo xcodebuild -license accept
, I get the following:xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
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??
OS: Mojave 10.14.6 Xcode version: 11.3
As of Jan 2020, for xcode-select to work, it needs to point to xcode.app’s location. When I downloaded xcode from developer page, it was directly unpacked in ‘Downloads’ folder. So, I changed the path to point to downloads folder like so:
sudo xcode-select -switch /Users/(yourUserNameHere)/Downloads/Xcode.app/Contents/Developer
And Boom! It worked after so much struggle. Hope this helps someone.
For those who come here from google This also helps in some cases
If you’re on the new Mojave beta versions (at least) the trick was to completely reset the
xcode-select
settings usingxcode-select -r
.I know this is not the best place for it; but this is the top result on Google, so hopefully this helps other people landing here due to a
yarn install
ornpm install
error:For me, on OSX 10.13.6 High Sierra, node 10.6.0 and npm 6.1.0, this was due to the slightly outdated 3.6.2 version of
node-gyp
shipped withnpm
.TL;DR, I fixed it with
Root cause seems to be
XcodeVersion()
throwing up:As logged above, this happens with
node-gyp v3.6.2
, but the above regex bug was fixed inv3.6.3
:I double-checked that my
node
andnpm
were the latest version, but sadly as it turns outnpm 6.1.0
still tracksnode-gyp 3.6.2
.Therefore, I artifically upgraded
By running
To get to
At which point I could run my
yarn install
again without issue.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?
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.
@Tibicenas @dbranchini did either of you try my suggestion?
The Downloads folder is not a good place to store apps.
From https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md
For the record, as @dpnishant commented
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
worked for me on macOS Catalina (Beta) as of todayIn addition to @jfmercer’s perfect answer, make sure you’ve accepted the license too.
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 withnpm i -g npm
. After that, runningyarn
worked correctly and this issue was gone. Indeed, this comment suggests just that, referring to #1370 (“gyp: don’t print xcodebuild not found errors”):In case it helps, I was setting up a project that required
"node": ">=8.0 <10"
, and had installed it withnvm install 9
.I already have Xcode so I removed CommandLineTools and linked Xcode. Thoughts?
xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
So basically everyone seems ok with installing a 5G file just to get xcode, for the sole purpose of getting node-gyp to compile (even though gcc is already installed through the command line tool)
can’t believe this still happening late 2017.
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.
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.
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.
Just upgraded MacOS today, together with an xcode update. I guess somehow that upgrade broke xcode command line tools…
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?
I had an existing installation of the CLI tools. (macOS 10.15.2) After deleting the tools and running the install command, a dialog will prompt that it’s installing. 👉 NOTE: At the same time you’ll get a notification that “Updates are available” – do not dismiss.
After the first installation completes, the tools are not available:
Proceed to accept installing the update from the notification. This process took a bit longer.
After that the path is set:
I’m still getting the error below on macOS Mojave. I have the command line tools, and installing Xcode is not an option for me at the moment because my internet connection is unstable and slow.
@skylarweaver This worked ☝️
It works with me on
macOS High Sierra
, thanks a lot!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.
I think
xcode-select --install
attaches itself to the node version you have installed at the time. So if you’re usingnvm
,asdf
or similar, the install process will be linked to the current Node version, and will break if you switch to another version.You also need to run this:
sudo xcodebuild -license
If your logs look like this:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
this fixed the issue for me
The solution from @eiTanLaVi worked for me, too 👍 OSX Mojave 10.14.3
@eiTanLaVi helped solve the issue for me!
None of the other solutions worked for me, however deleting my package-lock.json and reinstalling
npm install
allowed it to rebuild correctly.@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.
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.
This stack overflow answer pointed me in the right direction. Hope it helps
https://stackoverflow.com/a/17980786
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.
sudo xcode-select -s … needs to be followed by: sudo xcodebuild license before you ‘make’ or ‘configure’ again.
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.
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.
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.
This one worked for me on a brand new install of Catalina
I’m getting this error on Mojave with node 13.1.0, npm 6.12.1 and yarn 1.19.1
@davis @gibfahn Considering this page comes up in Google searches, can we update the issue description for the latest versions of macOS?
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
I did actually need to install XCode, and that solved all my problems.
if
make
failed while you do rebuild, trynpm audit fix
FWIW this error was a “red herring” for me. A simple
brew upgrade npm
fixed itAlso works with fresh install macos 10.14, but has to run
sudo xcode-select -r
to run it as root - that was needed.I had to update
node-gyp
and add it as a dev dependency for this to work after selecting xcode command line tool@skylarweaver This worked for me. THANK YOU.
Used command ‘sudo xcodebuild -license accept’ to accept the license.
Thank you. This is helpful.
@vb2807 note these lines:
The
gyp info ok
means that thegyp
part succeeded, the error is the bit that comes later:Which as @bnoordhuis points out, is an error with the grpc module.
@sebastianhaberey Just Command Line Tools works, see https://github.com/nodejs/node-gyp/issues/569#issuecomment-259421050.
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 agree that it’s utterly frustrating to have to install 6GB of XCode. The Ruby on Rails documentation that was linked earlier in this thread states:
That seems like a reasonable approach. Any reasons why this should be different for nodejs? Not flaming but genuinely interested in technical reasons.
I also get the error… however verifying my settings… [fireheadman@demon ~ 613]$ sudo xcode-select --switch /Library/Developer/CommandLineTools [fireheadman@demon ~ 615]$ xcode-select -p /Library/Developer/CommandLineTools
I was able to ignore the error and homebridge (in my case) works fine without needing the full Xcode install.