How to Uninstall and Reinstall XCode Os OS X

If you want to remove XCode on OS X (aka Developer Tools) you can do the following:

If installed from the developer portal:

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

If installed via App Store it should be:

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

NOTE: To be able to install Developer Tools from the App Store, you need to delete Install XCode from your /Applications folder something like this should work:

sudo rm -Rf /Applications/Install Xcode.app

Then once you download the Xcode from the App Store, it is not installed yet. You need to go to the same place /Application/Install Xcode.app and run the installer.