How to fully remove Xcode 4

XcodeXcode4

Xcode Problem Overview


I want to remove all existing SDK versions as well as Xcode 4.

Xcode 4 Guide says to do this:

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

But I don't have Xcode4 at this location and the only place I see it is under /Developer/Applications

I've already run the uninstall-devtools that was previously found in /Developer/Applications and then did a reinstall.

What else can I do to completely remove everything and start from scratch?

Xcode Solutions


Solution 1 - Xcode

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 - Xcode

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 - Xcode

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 - Xcode

su (or sudo su, whatever)

find / -name uninstall-devtools

This will reveal where the utility is...

Solution 5 - Xcode

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

Solution 6 - Xcode

If you have installed xcode from Mac App store, then you need to delete it from Launch pad. You can do this by locating xcode icon in launch pad, long click on the icon till it starts dancing. Then delete it and wait for a while till the xcode.app is deleted from /Application. If you manually delete xcode.app from /Application, App store will continue to think its installed and will not allow you to reinstall in future.

Solution 7 - Xcode

I tried to uninstall this by deleting it, but the AppStore still thought that it was installed. I deleted some preferences files in my /private directory, which made the AppStore "forget" that I had installed Xcode. I used the following command:

sudo find / -iname '*xcode*' 2> /dev/null | egrep '^/private.*' | xargs -I file sudo rm -rfv file

Which deleted the following files from my computer:

/private/var/db/receipts/com.apple.pkg.XcodeMAS_iOSSDK_6_1.bom
/private/var/db/receipts/com.apple.pkg.XcodeMAS_iOSSDK_6_1.plist
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503/CachedSpecifications-Xcode
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503/CachedSpecifications-xcodebuild
/private/var/folders/7d/n34963zx62s7znxyzn3dn6bh0000gq/C/com.apple.Xcode.503

I do not know what these files are used for, but it made the AppStore forget that it was installed, which is what I needed to happen. In my case, the AppStore was not allowing me to update to the new version of Xcode.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJonas AndersonView Question on Stackoverflow
Solution 1 - XcodeesqewView Answer on Stackoverflow
Solution 2 - XcodeChrisView Answer on Stackoverflow
Solution 3 - XcodeocculusView Answer on Stackoverflow
Solution 4 - Xcodem4f1050View Answer on Stackoverflow
Solution 5 - XcodeDenTheManView Answer on Stackoverflow
Solution 6 - XcodesureshView Answer on Stackoverflow
Solution 7 - XcodeHuckphinView Answer on Stackoverflow