node-gyp cache on Mac: safe to delete the Node headers?
Safe to deleteRegenerated automatically; Thermo deletes it outright.
Where it is
~/Library/Caches/node-gyp~/.node-gyp
What it is
node-gyp is the tool npm uses to compile native Node.js addons written in C or C++. To build against a given Node version it downloads that version's headers and libraries and caches them, one folder per version, in ~/Library/Caches/node-gyp (older releases used ~/.node-gyp).
Why it gets so big
Every Node version you've built a native module against leaves its own set of headers behind. If you switch versions often with nvm, fnm or a similar tool, these folders accumulate, though each one is fairly small.
Is it safe to delete?
Yes. The next time a package with a native addon installs or rebuilds, node-gyp downloads the matching headers again. Modules that are already compiled aren't affected.
See how much space it uses
du -sh "$HOME/Library/Caches/node-gyp" "$HOME/.node-gyp" 2>/dev/nullDelete it by hand
Run in Terminal. Deleting cannot be undone, so check the paths first.
rm -rf "$HOME/Library/Caches/node-gyp"/*
rm -rf "$HOME/.node-gyp"/*