How to fully remove Xcode 4

Solution 1:

I use this command:

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

Edit (1 year later):

If you've downloaded Xcode from the App Store, it's self-contained, as @mediaslave suggests. You can just drag it to the trash or use AppZapper (or a similar utility) to remove the developer tools.

If you're looking to update it, you can also do that straight through the App Store.

Solution 2:

sudo /[xcode-path]/Library/uninstall-devtools --mode=all

Normally, [xcode-path] means /Developer, but if you have multiple versions, for example 3 is the first installed, 4 is second, /Developer will be xcode 3's root derectory and /Xcode4 for xcode 4.

Solution 3:

Ensure Xcode, iOS Simulator, and the Mac App Store apps aren't running, then trying running the uninstall script at this (different!) location:

/Library/Developer/Shared/uninstall-devtools

This is where I found it.

Also delete Install Xcode.app from Applications folder, and Empty Trash.

Then run App Store again, and find/install Xcode.

Solution 4:

su (or sudo su, whatever)

find / -name uninstall-devtools

This will reveal where the utility is...

Solution 5:

If you have XCode 4.3.1, just Move To Trash the XCode.app file in the Applications folder.