Advertisement
opexxx

remove_CLI_tools.sh

Feb 9th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.26 KB | None | 0 0
  1. # remove_CLI_tools.sh
  2. # written by cocoanetics:http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/
  3. # modified by yoneken
  4.  
  5. #!/bin/sh
  6.  
  7. RECEIPT_FILE1=/var/db/receipts/com.apple.pkg.DevSDK.bom
  8. RECEIPT_PLIST1=/var/db/receipts/com.apple.pkg.DevSDK.plist
  9. RECEIPT_FILE2=/var/db/receipts/com.apple.pkg.clang.bom
  10. RECEIPT_PLIST2=/var/db/receipts/com.apple.pkg.clang.plist
  11. RECEIPT_FILE3=/var/db/receipts/com.apple.pkg.llvm-gcc4.2.bom
  12. RECEIPT_PLIST3=/var/db/receipts/com.apple.pkg.llvm-gcc4.2.plist
  13. RECEIPT_FILE4=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom
  14. RECEIPT_PLIST4=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
  15.  
  16. if [ ! -f "$RECEIPT_FILE4" ]
  17. then
  18.   echo "Command Line Tools not installed."
  19.   exit 1
  20. fi
  21.  
  22. echo "Command Line Tools installed, removing ..."
  23.  
  24. # Need to be at root
  25. cd /
  26.  
  27. # Remove files and dirs mentioned in the "Bill of Materials" (BOM)
  28. lsbom -fls $RECEIPT_FILE1 $RECEIPT_FILE2 $RECEIPT_FILE3 $RECEIPT_FILE4 | sudo xargs -I{} rm -r "{}"
  29.  
  30. # remove the receipt
  31. sudo rm $RECEIPT_FILE1 $RECEIPT_FILE2 $RECEIPT_FILE3 $RECEIPT_FILE4
  32.  
  33. # remove the plist
  34. sudo rm $RECEIPT_PLIST1 $RECEIPT_PLIST2 $RECEIPT_PLIST3 $RECEIPT_PLIST4
  35.  
  36. echo "Done! Please restart XCode to have Command Line Tools appear as uninstalled."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement