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

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.

reidelliott avatar Jan 16 '19 23:01 reidelliott

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

zachfeldman avatar Jan 18 '19 20:01 zachfeldman

@eiTanLaVi helped solve the issue for me!

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

mvirbicianskas avatar Feb 08 '19 09:02 mvirbicianskas

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

$ sudo xcodebuild -license

achillesrasquinha avatar Feb 13 '19 17:02 achillesrasquinha

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

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

garrettgsb avatar Feb 26 '19 18:02 garrettgsb

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

love u,it solved my problem perfectly !

quenshea avatar Mar 04 '19 08:03 quenshea

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

akaRem avatar Mar 11 '19 21:03 akaRem

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

jjercx avatar Apr 08 '19 15:04 jjercx

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

vrdriver avatar Apr 17 '19 12:04 vrdriver

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.

mtimofiiv avatar Apr 24 '19 03:04 mtimofiiv

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

dpnishant avatar May 07 '19 19:05 dpnishant

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

this fixed the issue for me

rajm avatar May 29 '19 05:05 rajm

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

rpaskin avatar Jun 15 '19 12:06 rpaskin

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

krulik avatar Jun 20 '19 20:06 krulik

thanks! @jfmercer, it`s works for me.

claudemirmendes avatar Jun 25 '19 16:06 claudemirmendes

@davis @gibfahn Considering this page comes up in Google searches, can we update the issue description for the latest versions of macOS?

NathanHazout avatar Jul 24 '19 12:07 NathanHazout

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

gibfahn avatar Jul 25 '19 09:07 gibfahn

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

rraallvv avatar Sep 24 '19 14:09 rraallvv

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.

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.

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.

codemedici avatar Oct 07 '19 21:10 codemedici

Hi, This work for me: $ sudo rm -rf /Library/Developer/CommandLineTools $ xcode-select --install

gingerIZ avatar Nov 11 '19 04:11 gingerIZ