Xcode Command Line Tools Version

lsv
New Contributor III

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.

 

1 ACCEPTED SOLUTION

sdagley
Esteemed Contributor II

@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 solution in original post

2 REPLIES 2

sdagley
Esteemed Contributor II

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

lsv
New Contributor III

Thank you!