How to clean uninstall Xcode on Mac

Many times it happens that you update your MacOS and then some new update comes up for the Xcode version and there is a backwards compatibility issue. Then you go to the App Store on your Mac to update the Xcode and Bam! You end up wasting hours because the installation gets stuck. It keeps showing installing for hours. If you force shutdown your MacOS and restart, then again the same story.

This time it happened with me again after I updated MacOS Catalina and installation of Xcode 11.3 just doesn’t end. Stopping in App Store doesn’t work.

Another way is, going to the Launchpad and holding down the alt/option key till all the icons start to jiggle. Then click on the x icon and you’ll be prompted to confirm to delete the Xcode App. Well, this also didn’t work for me. Then restart your Mac to move to the next steps.

Go to the Applications folder and find the Xcode App, right-click on it and move it to Trash/Bin. Empty the Trash/Bin.

For newer versions of Xcode, this step should be sufficient. You can go ahead and re-install Xcode from the App Store.

Removing from the Terminal

You need to run the following command in order to completely remove Xcode:

sudo /Developer/Library/uninstall-devtools --mode=all

The above command requires the admin password for sudo. If you get the error that the above command not found, then it probably doesn’t work for the newer versions of Xcode.

You might need to consider backing up the data in case you have Projects in the Developer folder and certain preferences to preserve in case you’re reinstalling. Back-up some of these files/folders before deleting anything:

~/Library/Developer/Xcode/UserData/CodeSnippets
~/Library/Developer/Xcode/UserData/FontAndColorThemes
~/Library/Developer/Xcode/UserData/KeyBindings
~/Library/Developer/Xcode/Templates
~/Library/Preferences/com.apple.dt.Xcode.plist
~/Library/MobileDevice/Provisioning Profiles

The following folders are cleared with complete uninstallation of Xcode:

  • /Applications/Xcode.app
  • /Library/Preferences/com.apple.dt.Xcode.plist
  • ~/Library/Preferences/com.apple.dt.Xcode.plist
  • ~/Library/Caches/com.apple.dt.Xcode
  • ~/Library/Application Support/Xcode
  • ~/Library/Developer/Xcode
  • ~/Library/Developer/CoreSimulator
  • /System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.bom
  • /System/Library/Receipts/com.apple.pkg.XcodeExtensionSupport.plist
  • /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.bom
  • /System/Library/Receipts/com.apple.pkg.XcodeSystemResources.plist
  • /private/var/db/receipts/com.apple.pkg.Xcode.bom

Remove the files at ~/Library/Caches/com.apple.dt.Xcode is basically clearing the cache. You can delete anything under /Library/Developer/ directory, such as CommandLineTools and CoreSimulator, except PrivateFrameworks subfolder. This might cause your newly installed Xcode to crash until you put it back.

Share your experience on what worked for you to make this post better.

Advertisement

3 thoughts on “How to clean uninstall Xcode on Mac

  1. The command:

    sudo /Developer/Library/uninstall-devtools –mode=all

    Does not work on macOS Catalina 10.15.4. Terminal says: command not found

    Like

Leave a Reply to mrjozo Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.