Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update acid test #2105

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions macOS_Catalina.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ If `ProductVersion` is less then `10.15` then this document is not for you. Norm

### The acid test
To see if `Xcode Command Line Tools` is installed in a way that will work with `node-gyp`, run:
1. `/usr/sbin/pkgutil --packages | grep CL`
* `com.apple.pkg.CLTools_Executables` should be listed. If it isn't, this test failed.
2. `/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`.
```
curl -L https://github.com/nodejs/node-gyp/raw/master/macOS_Catalina_acid_test.sh | bash
```

If test 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](#Solutions).
If test failed, there is a problem with your Xcode Command Line Tools installation. [Continue to Solutions](#Solutions).

### 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.
Expand Down
21 changes: 21 additions & 0 deletions macOS_Catalina_acid_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

pkgs=(
"com.apple.pkg.DeveloperToolsCLILeo" # standalone
"com.apple.pkg.DeveloperToolsCLI" # from XCode
"com.apple.pkg.CLTools_Executables" # Mavericks
)

for pkg in "${pkgs[@]}"; do
output=$(/usr/sbin/pkgutil --pkg-info "$pkg" 2>/dev/null)
if [ "$output" ]; then
version=$(echo "$output" | grep 'version' | cut -d' ' -f2)
break
fi
done

if [ "$version" ]; then
echo "Command Line Tools version: $version"
else
echo >&2 'Command Line Tools not found'
fi