Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Emptying my Trash in OS X Lion (non securely) is taking about three hours (about 1.5 million files, from a Time Machine backup). I had to stop the process a few times already, because I could not move my laptop with the external harddrive the files are on. This is also a problem because the Trash emptying is restarted from the very beginning each time I empty the Trash again (i.e., files are not deleted when the Trash emptying is aborted).

I read that it is faster to use rm -rf on ~/.Trash, in this case. However, is this safe? (I am afraid that does OS X Lion performs tasks behind the scenes—which would explain its slowness—that rm -r does not, which could lead to problems in the future.)

share|improve this question

3 Answers 3

up vote 6 down vote accepted

It is safe. OS X is probably just detecting the file is in use by some program, or running. If you know you really want it gone, rm it. The next reboot, whatever process was using it will be gone.

BE CAREFUL using rm -r It recursively deletes all subdirectories beneath the directory specified. If you're not familiar with shells, I'd suggest just using rm and explicitly specify files you want deleted (though you said there are lots of files).

Try this: rm -r ~/.Trash/*

That will remove all files and folders within the .Trash folder, without deleting the .Trash folder.

share|improve this answer
    
Thank you. Do you have a reference about this? (Why letting the Finder empty the Trash is slower than rm, why it does not always do anything useful behind the scenes (like checking if the files are open), etc.). –  EOL Nov 16 '12 at 9:57
2  
I cannot find any solid info on why, Apple Developers would probably know. I assume that when you empty the trash normally, for each file, it must check if the file is in use (locked by a process). When you have only a few files, these checks don't take too long, but when you have a large number of files, it can take awhile to do this extra check. If the trash complains that a file is in use, you can actually check it with lsof | grep filename. This will show you what process had a lock on that file. Even if it's in use, you can still remove it with rm. –  BrenanK Nov 16 '12 at 17:40
2  
Here's some Info on Emptying the Trash by Apple: Emptying the Trash You can see some of the checks it does, some are part of UNIX (Permissions) which is what OS X is built upon, and some are part of OS X (Locking) –  BrenanK Nov 16 '12 at 18:24
1  
Thanks. Permissions are also checked for rm. So I guess we're left with locking checks, to explain the time difference between running Empty trash and rm… –  EOL Nov 17 '12 at 9:35

If you have "Secure Empty Trash" enabled, this is likely to occour. It does a 3-pass deletion on the files to ensure that they are not recoverable. If you would like a speedier empty of the trash, and aren't especially concerned with privacy, you can disable it in the Finder preferences under the "Advanced" section.

share|improve this answer
    
I do not have "Secure Empty Trash" enabled. The problem was different, unfortunately. –  EOL Apr 4 '13 at 3:44

There is a nice app I use called "TrashIt!". You run it, it pulls up a small window that has 3 buttons: Cancel, Really Stuck, and Fast. Really Stuck is for when it's taking forever, Fast is just a quick delete. I'm guessing the app basically runs these scripts for you. But after running TrashIt!, it usually takes a few seconds to show the Trashcan as empty, but it works great. You do have to enter your administrative password to perform a delete though. Other than that, it's as quick as going to the trachcan and clicking Securely Empty Trash, or using this script. I believe the app was free. I realize this is an old article, but this is still an issue with Mavericks, so it's still applicable. I just found the download site, and it is free. Here you go if you're interested:

http://www.macupdate.com/app/mac/8214/trash-it!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.