How can I not have Command Line Tools installed, yet still have it?

$ type git
git is hashed (/usr/bin/git)
$ /usr/bin/git --version
git version 2.24.3 (Apple Git-128)
$ pkgutil --pkgs | grep ^com.apple
com.apple.update.fullbundleupdate.19H2
com.apple.pkg.update.os.10.15.7Supplemental.19H15
com.apple.pkg.EmbeddedOSFirmware
com.apple.update.fullbundleupdate.19H15
com.apple.update.fullbundleupdate.19G2021
com.apple.pkg.update.os.10.15.7.19H2
com.apple.pkg.SecureBoot
com.apple.pkg.update.os.SecUpd2020-001Catalina.19H114
com.apple.pkg.update.os.10.15.6Supplemental.19G2021
com.apple.pkg.Core
com.apple.update.fullbundleupdate.19H114
com.apple.pkg.XProtectPlistConfigData_10_15.16U4147
com.apple.files.data-template
com.apple.pkg.XProtectPlistConfigData_10_15.16U4145
com.apple.pkg.MRTConfigData_10_15.16U4142
com.apple.pkg.MRTConfigData_10_15.16U4146
com.apple.pkg.IncompatibleAppList.10_15.16U1923
com.apple.pkg.Pages10
com.apple.pkg.iMovie_AppStore
com.apple.pkg.Keynote10
com.apple.pkg.Numbers10
$ ls /Applications/Xcode.app
ls: /Applications/Xcode.app: No such file or directory

As you can see, I have neither the Command Line Tools, nor Xcode installed, yet I still have Command Line Tools. How is this possible? Is there something that I'm missing?


Git being there means some part of the CLT is there, since the shim doesn't come up, and since Xcode is not installed.

It is a known problem that the receipt for the CLT may disappear. One documentation of this is by MacPorts, linked here.

  • Download the command line tools package from the ​Apple Developer site.

  • If the version of the CLT you need is not listed at the developer site, but an older version is, reinstalling that will restore the package receipts. Then just run Software Update to trigger the update to the newer version.

  • Or, on Mac OS X 10.9 or greater, Software Update can reinstall the package:

    sudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
    softwareupdate -l
    
  • ​Run Software Update

    sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress