diff --git a/pylib/gyp/xcode_emulation.py b/pylib/gyp/xcode_emulation.py index 9a717d9095..42a4ce47ed 100644 --- a/pylib/gyp/xcode_emulation.py +++ b/pylib/gyp/xcode_emulation.py @@ -1541,6 +1541,13 @@ def CLTVersion(): except GypError: continue + regex = re.compile(r'Command Line Tools for Xcode\s+(?P\S+)') + try: + output = GetStdout(["/usr/sbin/softwareupdate", "--history"]) + return re.search(regex, output).groupdict()["version"] + except GypError: + return None + def GetStdoutQuiet(cmdlist): """Returns the content of standard output returned by invoking |cmdlist|.