Completely remove Xcode from OSX Lion

First you want to try running this:

sudo /Developer/Library/uninstall-devtools -mode=all
sudo rm -rf /Developer

Repeat above for any other directories beginning with Developer in your root directory. For some reason I had two: Developer and Developer-3.2.6.

Some systems may have a /Library/Developer/Shared directory also, so make sure you check for that directory, it will have its own uninstall-devtools script.

After that delete the install app (this will make sure the AppStore knows its been uninstalled):

sudo rm -rf /Applications/Install Xcode.app

Some people may also find deleting the AppStore cache helps, but only do this if the above doesn’t work, remember to replace “your username” with the actual directory name:

sudo rm -rf /Library/Caches
sudo rm -rf /User/your username/Library/Caches/com.apple.appstore

Done!

And let me know if you have any other tips.