Apple - Unable to clear Xcode from Trash. Force clear in Terminal returns permission error?

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)