如何完全删除 Xcode 4

我想删除所有现有的 SDK 版本以及 Xcode 4。

Xcode 4 Guide 说要这样做:

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

但我没有 Xcode4在这个位置和唯一的地方,我看到它是下 /Developer/Applications

我已经运行了之前在 /Developer/Applications中找到的卸载 devtools,然后进行了重新安装。

我还可以做什么来完全删除一切,从头开始?

79791 次浏览

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.

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.

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.

su (or sudo su, whatever)

find / -name uninstall-devtools

This will reveal where the utility is...

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

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.

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.