Xcode 1 through Xcode 4.2
Before Xcode 4.3, uninstalling means running a script. Assuming you installed Xcode to /Developer, you would do this
brian-mac-pro:bfitz$ sudo /Developer/Library/uninstall-devtools --mode=all
This actually runs a handful of other scripts to uninstall the various pieces that the Xcode installer put on your system, and in looking at the scripts, they are really wrappers for pkgutil invocations to remove files and package receipts.
Xcode 4.3 and up
As of Xcode 4.3, it is self-contained – uninstalling Xcode is a matter of throwing away Xcode.app. Mostly; if you install separate command-line tools, those need to be uninstalled by hand – or by script, and you can find a script here that will uninstall them: http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/; said script uses the package receipts and
lsbom to find and remove all the files in the package. Note that this isn’t really the “right” way to do this, instead you’re supposed to be discovering and iterating through
Note that you don’t actually need to install the separate command-line tools, if you’re willing to use the ones located inside the Xcode.app bundle; you use xcrun to find and run one, for example, xcrun git would find and run /Applications/Xcode.app/Contents/Developer/usr/bin/git, assuming that your Xcode is in /Applications.