Lana Y. writes in with a problem related to getting rid of files in OS X. Like many people, she wants to use Trash as a way station and then opt to empty trash later. Instead, she notes (along with the screen captures below):
My files are deleted immediately, without possibility to access them in Trash. I tried to change the privileges and tried to find Trash in terminal. Nothing helps.
This is a common and frustrating problem, and Lana isn’t alone. The file permissions associated with trash are out of whack, making it impossible for OS X to write new files to the Trash folder, and OS X doesn’t have a friendly way to repair it, even though your Mac knows enough that it can’t write to the folder! (OS X could note the problem and ask a user, “There’s something wrong with your Trash, which prevents files from being put there. Would you like to repair it?” as one possibility. OS X notices similar other problems.)
The underlying Unix directory for files en route to deletion isn’t global but is located in each user’s home directory. This is transparent to you when using OS X unless the permissions for the directory become messed up. In that case, because OS X can’t move the items you want to delete into this temporary location, you’re prompted to delete files or folders immediately. (You’ll see this warning when deleting files from mounted fileservers, too, for the same reason.)
You can solve this via the Terminal although you need to be even more careful than usual in entering a command there, as you could delete other files if you don’t copy and paste (or, type in) the exact sequence—it won’t just fail, but could delete parts of your drive.
With that warning in place, follow these steps when logged into your account, which has to have administrative privileges for this to work:
Launch Application > Terminal.
At the command prompt type (or, preferably, copy and paste):
sudo rm -ri ~/.Trash
You should first be prompted for your account’s password; enter it, and press return.
You should next be prompted to remove any files and folders in the
.Trashfolder, followed by the
.Trashfolder itself. Type
yesand return at each prompt. (This is a great place to notice if you’ve entered anything incorrectly above, too, and to press Control-C to halt the removal if you have.)
Log out of your OS X account ( > Log Out [user name], which closes all programs) and log back in. The problem should be solved, as OS X will create a new
.Trashfolder with the correct permissions.
(If you like to live dangerously, use the command
sudo rm -rf ~/.Trash instead to bypass being prompted to delete each file or folder. But I warned you.)
If you continue to have problems, you may have permissions problems on mounted drives. You can repeat the above operation for each volume, which contains a hidden top-level
.Trashes folder with separate folders for each user in OS X.
In step 3, instead of
~/.Trash, you use each volume’s name instead. In OS X, you can type
df -H to find the names of each volume, which are listed under a Mounted On column in form
/Volumes/ plus the drive’s name.
Unix doesn’t recognize spaces in names as part of the name unless they’re handled carefully, by putting a backslash in front of them, such as
/Volumes/My\ Main\ Backup\ Drive. You can avoid having to do this formatting by dragging the volume in question into the Terminal window after entering the command for step 2:
sudo rm -riplus a space.
Drag the volume onto the Terminal window, and it inserts the properly formatted volume name.
Now press Delete to remove a space after the drive’s name that’s automatically inserted, and add
Now log out of your account and back in, and you should have your Trash folder restored to normal. (If you’d like to be able to delete immediately, see my December 2015 column on using that function intentionally.)
Ask Mac 911
We’re always looking for problems to solve! Email yours to firstname.lastname@example.org including screen captures as appropriate. Mac 911 cannot reply to email with troubleshooting advice nor can we publish answers to every question.