Unable to clear Xcode from Trash. Force clear in Terminal returns permission error? Since the App Store seemed stuck with updating Xcode to 7.3, I have decided to delete it and reinstall. However, after moving Xcode to the Trash, it refused to be cleared and instead be stuck on the "Preparing to empty the trash..." window.
So, I've decided to force empty the trash in Terminal by rm -rf ~/.Trash/*, only to get an endless loop of error message saying this:

rm: /Users/jordanchanph/.Trash/Xcode.app/Contents/.../IOCatalogue/reset.xml: Permission denied


How can I empty the trash?
sudo rm -rf ~/.Trash/*


is your friend.

I would think cause of the errors are permissions, perhaps Xcode sets files with permissions exclusive to root (superuser).

What sudo does is run the following command (rm -rf ~/.Trash/*) with root privileges - think of it as "when in doubt with permission denied, sudo". Of course, the permission denied error is not to be ignored as it could be a sign of permissions errors. But, if you know what you are doing, sudo solves your problems. (this sums it up nicely)