I had previously installed Xcode 3.x on my machine from the included disks I got with my Macbook Pro. However, wanting to upgrade to Xcode 4 required me to use the AppStore, which installs Xcode in a different place. Uninstalling Xcode 3.x was a snap, and here's how I did it (Remember not to be in /Developer/Library when invoking the command):
sudo /Developer/Library/uninstall-devtools --mode=all
And my output:
Use of uninitialized value $pkgutil_volume_basename in concatenation (.) or string at /Developer/Library/uninstall-developer-folder line 35.
Start time: Sat Sep 17 10:22:35 EDT 2011
Analyzing devtools package: 'com.apple.pkg.DashcodeLeo'...
Analyzing devtools package: 'com.apple.pkg.DevDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.DevSamplesLeo'...
Analyzing devtools package: 'com.apple.pkg.DevToolsDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.DeveloperToolsCLILeo'...
Analyzing devtools package: 'com.apple.pkg.DeveloperToolsLeo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.4.UniversalLeo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.5Leo'...
Analyzing devtools package: 'com.apple.pkg.MacOSX10.6Leo'...
Analyzing devtools package: 'com.apple.pkg.OpenGLAppsLeo'...
Analyzing devtools package: 'com.apple.pkg.OtherDevDocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.X11DocumentationLeo'...
Analyzing devtools package: 'com.apple.pkg.clangLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.0ADCDocsLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.0Leo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.2ADCDocsLeo'...
Analyzing devtools package: 'com.apple.pkg.gcc4.2Leo'...
Analyzing devtools package: 'com.apple.pkg.llvm-gcc4.2Leo'...
Removing devtools files...
Removing generated files...
Removing Xcode Caches...
find: /var/folders/pb/__7g8h0s0y5d87rh096hfd400000gn/C/com.apple.DeveloperTools: No such file or directory
Removing Xcode Documentation...
Removing empty devtools directories...
Finish time: Sat Sep 17 10:25:28 EDT 2011
IMPORTANT: If you are going to install a previous version of the Developer Tools, be sure to restart the machine after installing.
Not sure what that error is at the top, but didn't seem like it affected anything. After that, I just removed /Developer since I'll be installing Xcode into /Applications anyways.