Skip to content

Instantly share code, notes, and snippets.

@raddevon
Created July 18, 2013 18:08
Show Gist options
  • Select an option

  • Save raddevon/6031554 to your computer and use it in GitHub Desktop.

Select an option

Save raddevon/6031554 to your computer and use it in GitHub Desktop.

Revisions

  1. raddevon created this gist Jul 18, 2013.
    24 changes: 24 additions & 0 deletions remove_xcode_cli_tools.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    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."