Skip to content

Commit f7bfce9

Browse files
vladimyrrvagg
authored andcommitted
doc: update acid test and introduce curl|bash test script
PR-URL: #2105 Reviewed-By: Rod Vagg <[email protected]>
1 parent 4937722 commit f7bfce9

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

macOS_Catalina.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ If `ProductVersion` is less then `10.15` then this document is not for you. Norm
2121

2222
### The acid test
2323
To see if `Xcode Command Line Tools` is installed in a way that will work with `node-gyp`, run:
24-
1. `/usr/sbin/pkgutil --packages | grep CL`
25-
* `com.apple.pkg.CLTools_Executables` should be listed. If it isn't, this test failed.
26-
2. `/usr/sbin/pkgutil --pkg-info com.apple.pkg.CLTools_Executables`
27-
* `version: 11.0.0` (or later) should be listed. If it isn't, this test failed.
28-
29-
If both tests succeeded, _you are done_! You should be ready to install `node-gyp`.
24+
```
25+
curl -L https://github.com/nodejs/node-gyp/raw/master/macOS_Catalina_acid_test.sh | bash
26+
```
27+
28+
If test succeeded, _you are done_! You should be ready to install `node-gyp`.
3029

31-
If either test failed, there is a problem with your Xcode Command Line Tools installation. [Continue to Solutions](#Solutions).
30+
If test failed, there is a problem with your Xcode Command Line Tools installation. [Continue to Solutions](#Solutions).
3231

3332
### Solutions
3433
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.

macOS_Catalina_acid_test.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
pkgs=(
4+
"com.apple.pkg.DeveloperToolsCLILeo" # standalone
5+
"com.apple.pkg.DeveloperToolsCLI" # from XCode
6+
"com.apple.pkg.CLTools_Executables" # Mavericks
7+
)
8+
9+
for pkg in "${pkgs[@]}"; do
10+
output=$(/usr/sbin/pkgutil --pkg-info "$pkg" 2>/dev/null)
11+
if [ "$output" ]; then
12+
version=$(echo "$output" | grep 'version' | cut -d' ' -f2)
13+
break
14+
fi
15+
done
16+
17+
if [ "$version" ]; then
18+
echo "Command Line Tools version: $version"
19+
else
20+
echo >&2 'Command Line Tools not found'
21+
fi

0 commit comments

Comments
 (0)