Skip to content

Instantly share code, notes, and snippets.

@rosuH
Forked from roalcantara/xcode-uninstall.sh
Created July 26, 2021 08:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosuH/7994876dfbbde1b39bcc56fc60b29bdc to your computer and use it in GitHub Desktop.
Save rosuH/7994876dfbbde1b39bcc56fc60b29bdc to your computer and use it in GitHub Desktop.
xcode-uninstall
killall Xcode
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang.$(whoami)/ModuleCache"
rm -rf /Applications/Xcode.app
rm -rf ~/Library/Caches/com.apple.dt.Xcode
rm -rf ~/Library/Developer
rm -rf ~/Library/MobileDevice
rm -rf ~/Library/Preferences/com.apple.dt.Xcode.plist
rm -rf ~/Library/Preferences/com.apple.dt.xcodebuild.plist
sudo rm -rf /Library/Preferences/com.apple.dt.Xcode.plist
sudo rm -rf /System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.bom
sudo rm -rf /System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.plist
sudo rm -rf /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom
sudo rm -rf /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist
sudo rm -rf /private/var/db/receipts/com.apple.pkg.Xcode.bom
# https://medium.com/@onexlab.io/uninstall-xcode-from-macos-eca1b69dc836
@HenkPoley
Copy link

HenkPoley commented Nov 22, 2022

Lets see if this fixes the issue on macOS Ventura that software updater kept insisting to update to 2 Command Line Tools for Xcode versions at the same time:

% softwareupdate --list
Software Update Tool

Finding available software
Software Update found the following new or updated software:
* Label: Command Line Tools for Xcode-14.0
	Title: Command Line Tools for Xcode, Version: 14.0, Size: 687109KiB, Recommended: YES, 
* Label: Command Line Tools for Xcode-14.1
	Title: Command Line Tools for Xcode, Version: 14.1, Size: 687455KiB, Recommended: YES, 

After running the above steps (and removing /Library/Developer/CommandLineTools) it has stopped showing up in the System Settings. So that's good 👍

Edit: After xcode-select --install ('Install Command Line Developer Tools') has run softwareupdate --list now shows "No new software available." 😊

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