Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

npm install stops with 'No Xcode or CLT version detected' on a Mac

Errorgyp: No Xcode or CLT version detected!

Short answer

node-gyp asks xcodebuild for a version and, if that fails, looks for the Command Line Tools package receipt. Neither answered. Install the tools with xcode-select --install, or point xcode-select at a full Xcode.app. Then run npm install again.

  • Applies to macOS 15, Xcode Command Line Tools, Node.js 22, npm 10
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    See which developer directory is active and whether the Command Line Tools package is registered.

    xcode-select -p
    pkgutil --pkg-info com.apple.pkg.CLTools_Executables
  2. 2Match what you see, then jump to its fix

    1. 1xcode-select -p fails, or pkgutil reports no such package.The Command Line Tools are not installedFix
    2. 2Xcode.app is in /Applications, yet xcode-select -p shows a different folder or an error.Full Xcode is installed but xcode-select points somewhere elseFix

What does the error look like?

  • gyp: No Xcode or CLT version detected!
  • gyp ERR! stack Error: `gyp` failed with exit code: 1

Cause 1 of 2

The Command Line Tools are not installed

1Check

node-gyp needs clang, clang++ and make, which the Command Line Tools provide on macOS.

xcode-select -p

2Fix

Install the tools on their own with the system installer, then wait for it to finish.

xcode-select --install

3Verify

The path prints and the install now builds native modules.

xcode-select -p
npm install

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 2

Full Xcode is installed but xcode-select points somewhere else

1Check

The xcode-select tool (see its man page on your Mac) sets the developer directory that xcodebuild and cc use. After an install or move of Xcode it can point at an old path.

xcode-select -p

2Fix

Select the Xcode you want (this needs sudo). If you want the default search behaviour back, reset instead.

sudo xcode-select --switch /Applications/Xcode.app
# or
sudo xcode-select --reset

3Verify

xcodebuild answers with a version, which is the first thing node-gyp asks.

xcodebuild -version

Confirmed by raw.githubusercontent.com

Did this fix it?

How do I stop it coming back?

  • After a macOS or Xcode upgrade, run xcode-select -p once before your next npm install.
  • Prefer package versions that ship prebuilt binaries so no compiler is needed.
  • Keep one Xcode or Command Line Tools install active instead of switching often.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Back end

ng serve cannot find the dev-server builder package

Could not find the implementation for builder @angular/build:dev-server

The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.