macOS_Catalina_acid_test.sh 495 B

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