It's possible that there are files in some other user's trash. The .Trashes
folder at the top of each volume has subfolders for each different user, by user ID number (e.g. user 502's trash is in .Trashes/502
).
You can see if it for yourself using a command like this (replace VolumeName
with your drive name):
ls -la /Volumes/VolumeName/.Trashes/
total 0
d-wx-wx-wt@ 3 _unknown _unknown 102 10 Feb 18:15 .
drwxrwxrwx@ 21 root wheel 782 13 Feb 14:17 ..
drwx------@ 35 _unknown _unknown 1190 13 Feb 14:18 502
Note: you might get a permissions error from this command, either because the .Trashes folder doesn't allow read access (solve this by adding sudo
, e.g. sudo ls -ls ...
, and entering your admin password when requested); and/or because of the privacy protections in macOS Mojave (10.14) and later (solve this by granting the Terminal access in System Preferences > Security & Privacy pane > Privacy tab > Full Disk Access category, see here for more details).
As you can see, on my USB disk .Trashes
folder there's a sub foder called 502
, owned by user ID 502 (for reference, my current user ID is 501). Since this user doesn't exist on my system, I see it as _unknown
, and my user can't look inside of it, neither delete it. To look inside that folder we need to do it as administrator (i.e. use sudo
).
If you are sure that you want to, you can delete everyone's trash by deleting the entire .Trashes
folder with a command like:
sudo rm -R /Volumes/volumeName/.Trashes
Warning: as with anything involving sudo
("do as super user", i.e. system administrator) and rm -R
, use this carefully. If you type it wrong, it could have ... unpleasant consequences.
I use a third party preference pane Compost that deletes from trash when the disk fills up or if the file has been in trash for a given time.
The original download stopped working for me but I have just found this on the author's site instead of the distributer. Note the author's comment
Compost is in a bit of a state of flux right now. The distributor has moved on to a different market and we wish them well in their endeavors. Additionally, the changes necessary to fully support Snow Leopard have been going through an extensive beta period as a result of the degree and complexity of changes required. Please stay tuned for more information.
So it might not work even from this download
When I updated this I had just installed it on Yosemite and it installed (but not enough time to see if it deleted anything) I have now updated to El Capitan and the installer fails.
Best Answer
It would be easier to use an alias like this:
rm -rf ~/.Trash/*
doesn't work if the list of filenames is longer thangetconf ARG_MAX
, and it doesn't include files that start with a period. Deleting files in trash folders often requires root permissions though.tell app "finder" to empty
andtrash -e
(see hasseg.org/trash) can be run silently or on the background, but they are just as slow as emptying the trash from the GUI, and they make Finder display error dialogs if for example files are in use.