I discovered that when I tried to trash a file it was deleted immediately and not going to the trash. I opened Terminal and typed in: sudo rm -rf ~/.Trash
That fixed the trash but it keeps reverting back to deleting files immediately instead of putting them in the trash.
Your trash isn't a single folder. You have (or can have) a trash folder on every volume. Moving a file to the trash means moving it to your trash folder on the volume the file is already on.
The reason is that it is not possible to
move a file to a different volume. You can approximate the effect by
copying a file to a different volume and then
deleting it on the original volume, but that kinda defeats the purpose of the trash, which is to postpone deletion. And besides, what if there isn't room to copy the file to the other volume? What if you want to put the file back where it came from, and there is no longer room for it on the original volume?
When Finder shows you the Trash, what it's really showing you is an amalgamation of all of your trash folders, as if they were a single folder. (This is one of the many little white lies Finder tells. It used to pull the same stunt with your desktop folders.)
~/.Trash is only one of your trash folders. That's the one that is used for all files that you trash from the same volume as the one your home folder is on.
For other local volumes, your trash folder is /Volumes/<volumeName>/.Trashes/<uid>, where <uid> is your numeric user id.
But users are a local concept. For non-local volumes, for example volumes mounted through file-sharing, you have no user id, and the system cannot uniquely assign you your own trash folder on that volume. Trashing a file from a shared disk volume requires that the file be deleted immediately. (It may be possible to defer the delete until you unmount the volume, but no longer.)
Even on a local volume, trashing a file might mean the file must be deleted immediately if:
- The appropriate trash folder does not exist and cannot be created
- The trash folder exists, but you don't have write permission to it. (You need write permission to a folder to add items to it.)
- You don't have write permission to the folder the file is in now. (You need write permission to a folder to remove items from it.)
Those conditions don't mean the file
must be deleted immediately; Finder
may instead report an error and refuse to trash the file at all.
If you've booted off a clone and start trashing items from your original volume, they will be moved to /Volumes/<originalName>/.Trashes/<uid>, assuming that folder can be created. (Only files you trash from the clone will be moved to ~/.Trash. Note that this is the clone's trash folder, not your original trash folder, because while you're booted from the clone, ~ is the clone of your home folder, not your original home folder.)
If /Volumes/<originalName>/.Trashes/<uid> cannot be created, or if you don't have write permission to it, trashed files will be deleted immediately. One gotcha is that once Finder makes that determination, it hangs onto the answer and doesn't re-check each time you try to trash something from that volume. If it says it'll trash a file by deleting it immediately, it'll keep on saying that for all files on that volume until you either unmount/remount the volume or quit/launch Finder again. The easiest fix is to log out (which quits Finder) and then log back in again.
If logout/login doesn't resolve the problem, you might try any of the following:
1. Remove your trash folder on the problem volume with:
UID=$(id -u)
sudo rm -rf /Volumes/"volumeName"/.Trashes/$UID2. Remove all trash folders on the problem volume with
sudo rm -rf /Volumes/"volumeName"/.TrashesThen logout/login to get Finder to re-asses the situation, and try trashing files again. Finder should re-create all the necessary folders with correct permissions.