How do I uninstall the command line tools for Xcode?

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?


Solution 1:

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.

  • Removing uninstalled Command Line Tools from AppStore updates