101

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?

Nathan Campos
  • 28,769
  • 59
  • 194
  • 300
Jonas Anderson
  • 1,987
  • 4
  • 24
  • 28
  • 1
    +1 for this question. I'm stuck with Xcode 4.1 and can't get 4.2 installed; uninstall-devtools script doesn't exist any more. – occulus Oct 18 '11 at 11:31

7 Answers7

194

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.

esqew
  • 42,425
  • 27
  • 92
  • 132
  • 14
    Xcode 4.3 does not have this. It is a "normal" OS X app self contained. FYI – manumoomoo Mar 06 '12 at 21:29
  • I tried to install 4.4 on top of 4.2 but the program crashed at startup. So I uninstalled 4.4, ran your command, reinstalled 4.4, and now things appear to work properly. Thank you – Giuseppe Sep 11 '12 at 12:46
  • Updated to reflect the concerns expressed by those who have downloaded their copy of Xcode from the App Store, thanks @mediaslave – esqew Sep 14 '12 at 13:35
25
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.

Ankit Srivastava
  • 12,347
  • 11
  • 63
  • 115
Chris
  • 1,264
  • 1
  • 10
  • 14
14

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.

cczona
  • 352
  • 4
  • 12
occulus
  • 16,959
  • 6
  • 53
  • 76
7

su (or sudo su, whatever)

find / -name uninstall-devtools

This will reveal where the utility is...

m4f1050
  • 103
  • 1
  • 9
7

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

DenTheMan
  • 1,277
  • 2
  • 13
  • 21
  • 3
    I would add "and then Empty the trash". It gives you 1 item if you didn't have anything in it before, but takes a while because it actually removes XCode from the Mac. – Sasho Mar 22 '12 at 10:06
5

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.

suresh
  • 2,365
  • 1
  • 26
  • 36
  • It may not be applicable anymore. I successfully uninstalled Xcode 4.6.1 by dragging it to trash directly without having any problems with Mac App Store thinking it's still installed on MacOsX 1.7.5. – Svarog Mar 28 '13 at 18:46
1

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.

Huckphin
  • 410
  • 4
  • 17
  • I removed all this. In fact I also removed pretty much every other *xcode* reference from my system but I still see this here: http://cl.ly/RYJ0. How to get rid of this? – amar Sep 23 '13 at 02:31