doc: update acid test and introduce curl|bash test script

PR-URL: https://github.com/nodejs/node-gyp/pull/2105
Reviewed-By: Rod Vagg <rod@vagg.org>
This commit is contained in:
Dario Vladovic 2020-04-25 01:29:45 +02:00 committed by Rod Vagg
parent 4937722cf5
commit f7bfce96ed
No known key found for this signature in database
GPG key ID: C273792F7D83545D
2 changed files with 27 additions and 7 deletions

View file

@ -21,14 +21,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.
```
curl -L https://github.com/nodejs/node-gyp/raw/master/macOS_Catalina_acid_test.sh | bash
```
If both tests succeeded, _you are done_! You should be ready to install `node-gyp`.
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.

View file

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