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.
This fixed it for me:
- Install Xcode
- Run
sudo xcode-select -s /Applications/Xcode.app/Contents/DeveloperSee 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.
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
@eiTanLaVi helped solve the issue for me!
npm explore npm -g -- npm install node-gyp@latest
In addition to @jfmercer's perfect answer, make sure you've accepted the license too.
$ sudo xcodebuild -license
The solution from @eiTanLaVi worked for me, too 👍 OSX Mojave 10.14.3
npm explore npm -g -- npm install node-gyp@latest
update node-gyp solved for me $ [sudo] npm explore npm -g -- npm install node-gyp@latest
love u,it solved my problem perfectly !
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
This fixed it for me:
- Install Xcode
- Run
sudo xcode-select -s /Applications/Xcode.app/Contents/DeveloperSee 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
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
There's also a GUI way to solve this.
- Start Xcode
- Go into Preferences -> Locations
- 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.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer worked for me on macOS Mojave 10.14.4 with node.js 8.10
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
this fixed the issue for me
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
update node-gyp solved for me $ [sudo] npm explore npm -g -- npm install node-gyp@latest
Thanks @eiTanLaVi ! solved my issue.
OSX Sierra 10.13.6, node 9.11.1, npm 5.6.0
thanks! @jfmercer, it`s works for me.
@davis @gibfahn Considering this page comes up in Google searches, can we update the issue description for the latest versions of macOS?
@nasht00 what isn't up to date with the latest macOS? You can either select the Xcode Command Line Tools, or you can select Xcode.app. Given that Xcode.app is 13Gb, most people will just install the Command Line Tools. I updated the original comment to include both options.
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.
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 #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 toolsthen 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/DeveloperIf 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 rebuildornpm install? If not then it's nothing to do withnode-gyp, raise a bug with the project you're using.
You also need to run this:
sudo xcodebuild -license
If your logs look like this:
> node-gyp rebuild
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
Hi,
This work for me:
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install