As stated by Cocoanetics
here, you can use this script to remove the tools completely:
remove_CLI_tools.sh
RECEIPT_FILE=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom
RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
if [ ! -f "$RECEIPT_FILE" ]
then
echo "Command Line Tools not installed."
exit 1
fi
echo "Command Line Tools installed, removing ..."
# Need to be at root
cd /
# Remove files and dirs mentioned in the "Bill of Materials" (BOM)
lsbom -fls $RECEIPT_FILE | sudo xargs -I{} rm -r "{}"
# remove the receipt
sudo rm $RECEIPT_FILE
# remove the plist
sudo rm $RECEIPT_PLIST
echo "Done! Please restart XCode to have Command Line Tools appear as uninstalled."
Pay attention to the disclaimer right under the script on that page:
Use at your own risk, it might remove more than you bargained for. So make sure you made a time machine backup before running this.
How are you uninstalling Xcode exactly? – Ramhound – 2013-08-29T15:08:49.323
@Ramhound That’s my question. It’s possible to “uninstall” Xcode by dragging Xcode.app to the trash, but that doesn’t touch any of the command-line tools. – bdesham – 2013-08-29T15:35:15.060