Skip to content

Instantly share code, notes, and snippets.

@meritozh
Created May 19, 2015 08:56
Show Gist options
  • Save meritozh/9742f9f7050059b19704 to your computer and use it in GitHub Desktop.
Save meritozh/9742f9f7050059b19704 to your computer and use it in GitHub Desktop.
Remove CLT via lsbom and rm in OS X yosemite
#!/bin/bash
DEV_SDK_RECEIPT_FILE=/var/db/receipts/com.apple.pkg.DevSDK_OSX1010.bom
DEV_SDK_RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.DevSDK_OSX1010.plist
DEV_TOOLS_RECEIPT_FILE=/var/db/receipts/com.apple.pkg.CLTools_Executables.bom
DEV_TOOLS_RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.CLTools_Executables.plist
if [ ! -f "$DEV_TOOLS_RECEIPT_FILE" ]
then
echo "Command Line Tools not installed."
exit 1
fi
echo "Command Line Tools installed, removing ..."
# Need to be at root
cd /
for BOM_FILE in $DEV_SDK_RECEIPT_FILE $DEV_TOOLS_RECEIPT_FILE
do
lsbom -fls $BOM_FILE | sudo xargs -I{} rm -r "{}"
sudo rm $BOM_FILE
done
# remove the plist files
sudo rm $DEV_SDK_RECEIPT_PLIST $DEV_TOOLS_RECEIPT_PLIST
echo "Done! Please restart XCode to have Command Line Tools appear as uninstalled."
@meritozh
Copy link
Author

You can modify it to delete anything via lsbom and rm that the software are installed by pkg installer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment