Skip to main content
Solved

Xcode Command Line Tools Version

  • Oct 20, 2023 7:05 PM UTC
  • 2 replies
  • 294 views

Forum|alt.badge.img+4

I'm trying to create an extension attribute for the version of Xcode Command Line Tools that is installed on each machine.

The goal is to eventually have a patch policy to regularly update the versions as needed.

The closest I have found is this post, however the attribute seems to no longer work and I can't seem to find any documentation to gather the version of Command Line Tools.

If anyone has had any luck with this recently I would greatly appreciate any guidance.

 

Best answer by sdagley

@lsv Here's an updated EA that returns the Command Line Tools version, or "Not Installed" if they're not installed:

#!/bin/sh result="Not Installed" CLIToolsVersion=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version | cut -d ' ' -f 2) if [ -n "$CLIToolsVersion" ]; then result="$CLIToolsVersion" fi echo "<result>$result</result>"
View original

2 replies

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • Answer
  • Oct 21, 2023 3:48 AM UTC

@lsv Here's an updated EA that returns the Command Line Tools version, or "Not Installed" if they're not installed:

#!/bin/sh result="Not Installed" CLIToolsVersion=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version | cut -d ' ' -f 2) if [ -n "$CLIToolsVersion" ]; then result="$CLIToolsVersion" fi echo "<result>$result</result>"

Forum|alt.badge.img+4
  • Author
  • Contributor
  • Oct 23, 2023 9:11 PM UTC

@lsv Here's an updated EA that returns the Command Line Tools version, or "Not Installed" if they're not installed:

#!/bin/sh result="Not Installed" CLIToolsVersion=$(pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version | cut -d ' ' -f 2) if [ -n "$CLIToolsVersion" ]; then result="$CLIToolsVersion" fi echo "<result>$result</result>"

Thank you!