2

I have Apple’s developer tools installed on my Mac and there is some linking weirdness that is preventing some of the binaries from running. The problem was not solved by reinstalling Xcode and its command-line tools, either the public version 4 or the developer-preview version 5. How can I completely delete the command-line tools in preparation for reinstalling them cleanly?

2
  • How are you uninstalling Xcode exactly?
    – Ramhound
    Commented Aug 29, 2013 at 15:08
  • @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
    Commented Aug 29, 2013 at 15:35

1 Answer 1

4

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.

1
  • Though the .bom and .plist files are named differently on OS X 10.10, this approach worked fine on Yosemite, too, to uninstall the command line tools installed by invoking "git".
    – Thomas S.
    Commented Dec 3, 2014 at 8:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .