53

We have a bunch of Mac at work that no longer require Xcode or command line tools so we'd like to remove them so the compilers aren't hanging around and we don't have to keep updating them when updates arrive.

Before Xcode was in the Mac App Store, there ware install and uninstall scripts (perl in /Developer) to remove the tools, but now that Xcode is an app store app you are left with the tools if you ever install them.

Can we clean this other than wiping the OS for macs running 10.10 and newer?

bmike
  • 235,889

1 Answers1

76

Delete this one folder:

 /Library/Developer/CommandLineTools

This uninstall process is documented officially by Apple.

If you have installed these tools another way or have prompts to upgrade them, consider searching for files named like /System/Library/Receipts/com.apple.pkg.CLTools.bom since that may be a receipt for a past installation of the tools that needs to be removed. I have never seen one of these files, but wanted to link to this other answer in case it helps others. Note, these files do not remove the tools, they may govern the prompt that dev tools are in need of an update.

bmike
  • 235,889
  • 1
    However whenever there's a command line tools update, the App Store keeps showing up to update it. – adib Jun 13 '18 at 22:53
  • Long time ago I used a DMG (needed to install an older version of the command line tools, but that's another story). Now I can't seem to get rid of it. – adib Jun 15 '18 at 01:26
  • Aah @adib - That makes sense. This question was for a new / recent install where you only go to the App Store and install Xcode - that will download the tools for you without leaving a receipt in my experience. – bmike Jun 15 '18 at 19:55
  • 1
    Hence, what would be the answer to really uninstalling Command Line Tools? – adib Jun 16 '18 at 13:25
  • @adib - It depends how they were installed. I’m trying to document how to remove them for sone specific install path, not all possible ones. See https://apple.stackexchange.com/a/312272/5472 – bmike Jun 17 '18 at 21:26
  • 3
    @adlib: I had the same problem, just managed to fix it by deleting the bom files from /System/Library/Receipts: https://apple.stackexchange.com/questions/328034/removing-uninstalled-command-line-tools-from-appstore-updates/328089#328089 Perhaps that'll help you as well. – Kenny Lövrin Jun 18 '18 at 09:15
  • Receipts may be found in /Library/Apple/System/Library/Receipts ... – Rob Dec 16 '20 at 22:57
  • To delete com.apple.pkg.CLTools* files from /Library/Apple/System/Library/Receipts, you must boot into Recovery and mount your Macintosh HD - Data volume. – JamesR Apr 17 '22 at 18:40
  • rm -rf $(xcode-select --print-path). However, if you use git you need the cmd tools. Otherwise, git cannot be installed. – Timo May 13 '22 at 09:15
  • this actually endless popups msg of "Git requires developertools to be installed would you like to install it now ? " I just can't get out of it – Ricky Levi Oct 25 '22 at 18:50