I upgraded to xcode 5 Command Line Tools on Friday. Something is not working correctly and I want to go back to the last 4.x version ox xcode. How do I uninstall xcode 5 com
I stumbled upon this while trying to uninstall Command Line Tools v6.
I had the full Xcode 6 installed, but moving Xcode to trash did NOT uninstall/delete CLT as well. I still had /usr/bin/clang for example. The solution was to manually remove CLT using the .bom contents (similar to @veducm's answer):
cd /
lsbom -fls /var/db/receipts/com.apple.pkg.CLTools_Executables.bom | sudo xargs -I{} rm -rf "{}"
lsbom -fls /var/db/receipts/com.apple.pkg.DevSDK_OSX109.bom | sudo xargs -I{} rm -rf "{}"
sudo rm /var/db/receipts/com.apple.pkg.{CLTools_Executables,DevSDK_OSX109}.{bom,plist}
Replace DevSDK_OSX109 with the version you have. You may have multiple ones, in which case, apply the same command to all of them (e.g. I had both DevSDK_OSX109 and DevSDK_OSX1010 because I had installed CLT for Mavericks and Yosemite too).
NOTE: This will delete the files listed in the .bom. You can view the contents them first by doing just lsbom -fls /var/db/receipts/com.apple.pkg.CLTools_Executables.bom etc if you are unsure.
NOTE2: You need the cd / since paths reported by lsbom are relative. You can also remove CLT by simply doing rm -rf /Library/Developer/CommandLineTools.