Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
How are you uninstalling Xcode exactly? –  Ramhound Aug 29 '13 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 Aug 29 '13 at 15:35

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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. Dec 3 at 8:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.