This document specifically refers to upgrades from previous versions of macOS to Catalina (10.15). It should be removed from the source repository when Catalina ceases to be the latest macOS version or when future Catalina versions no longer raise these issues.
Both upgrading to macOS Catalina and running a Software Update in Catalina may cause normal node-gyp
installations to fail.
Let's first make sure that your Mac is running Catalina:
% sw_vers
ProductName: Mac OS X
ProductVersion: 10.15
BuildVersion: 19A602
If ProductVersion
is less then 10.15
then this document is not for you. Normal install docs for node-gyp
on macOS can be found at https://github.com/nodejs/node-gyp#on-macos
To see if Xcode Command Line Tools
is installed in a way that will work with node-gyp
, run:
/usr/sbin/pkgutil --packages | grep CL
com.apple.pkg.CLTools_Executables
should be listed. If it isn't, this test failed./usr/sbin/pkgutil --pkg-info com.apple.pkg.CLTools_Executables
version: 11.0.0
(or later) should be listed. If it isn't, this test failed.
If both tests succeeded, you are done! You should be ready to install node-gyp
.
If either test failed, there is a problem with your Xcode Command Line Tools installation. Continue to Solutions.
There are three ways to install the Xcode libraries node-gyp
needs on macOS. People running Catalina have had success with some but not others in a way that has been unpredictable.
App Store
app.xcode-select --install
node-gyp
using the full Xcodexcodebuild -version
should show Xcode 11.1
or later.
sudo xcodebuild -license accept
# If you agree with the licensing terms.softwareupdate -l
# No listing is a good sign.
xcode-select -version
# Should return xcode-select version 2370
or later.xcode-select -print-path
# Should return /Applications/Xcode.app/Contents/Developer
sudo xcode-select --reset
# Enter root password. No output is normal.node-gyp
using the Xcode Command Line Tools via xcode-select --install
xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
, continue to remove and reinstallsoftwareupdate -l
# No listing is a good sign.
xcode-select -version
# Should return xcode-select version 2370
or later.xcode-select -print-path
# Should return /Library/Developer/CommandLineTools
sudo xcode-select --reset
# Enter root password. No output is normal.node-gyp
using the Xcode Command Line Tools via manual downloadsudo rm -rf $(xcode-select -print-path)
# Enter root password. No output is normal.sudo rm -rf /Library/Developer/CommandLineTools
# Enter root password.xcode-select --install
npm explore npm -g -- npm install node-gyp@latest
npm explore npm -g -- npm explore npm-lifecycle -- npm install node-gyp@latest
Lessons learned from: