Skip to main content
Solved

Xcode Command Line Tools Version

  • October 20, 2023
  • 2 replies
  • 134 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>"

2 replies

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • Answer
  • October 21, 2023

@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
  • October 23, 2023

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