Got files that won’t delete from your Mac’s Trash? Here’s why

By , Jun 8, 2016

OS X Full Trash App Icon

Sometimes when emptying the Trash on your Mac, you may get error messages that tell you files you’re trying to delete are in use. When you’re looking to delete everything that’s in your Trash to free up some storage space, error messages are going to be the last thing you want to see.

In this piece, we’ll talk about why you’re getting these messages and how to get your Mac to free up the file so you can delete it safely.

Mac still using files in your Trash?

OS X file in use Trash

I get messages multiple times per day where my Mac has an aneurysm and says “This operation can’t be completed because the item “[insert file name here]” is in use.”

These messages are entirely annoying because when I decide to empty my Trash, I’m doing it because I want to get rid of everything inside of it, not because I want to see error messages.

Because this is a widespread message among Mac users, it seemed like a good idea to discuss why you’re getting these messages, and to talk about possible solutions to the problem.

What’s going on?

Basically what your Mac is telling you is that a file from your Trash is still open in one of your Mac’s own apps.

What’s happening here is you’re trying to erase a file from your Mac’s filesystem that an app is still using. By erasing it, you would break something, whether it’s an email you’re composing with the attachment in the email, an open preview of a file you were viewing, or a file transfer of the file you were initiating through your favorite instant messenger client, and your Mac prevents you from breaking things by keeping you from deleting the file until the app is finished with using it.

Throughout my own daily work routine, the following apps have been known to cause the error message for me:

  • Mail
  • Preview
  • QuickTime
  • Skype

Although there are probably many more to add to this list, I use these four apps continuously throughout my workflow. The problem occurs mostly when I have text files, image files, or video files open in one of these apps, and then I try to delete the file after I’m done with it.

Unfortunately, although I’m done with the file, OS X apparently is not (yet).

For example the Mail app will make Drafts of emails in the midst of typing them before they are sent to the recipient. These Drafts have instances of the file you’re attaching, so even though you might have sent the email when you are finished composing it, the Mail app is still technically using an instance of that file in a saved Draft stored somewhere on your computer.

Now, when you try to remove that file from your Mac because you’re done with it, you’ll activate an error message saying the file is still in use.

Fixing the problem

Since you now understand that you’re getting the error message due to a process still using a file in your trash, you’re probably wondering what to do about it…

Well, the solution is an easy one: quit the app that’s using the file.

On the other hand, it can sometimes be difficult to pinpoint exactly what app is using the file, so you’ll have to take a moment to recall.

When I get one of these messages, I like to open the Trash to see what file(s) failed to delete. Then, I try to remember what app(s) I used the file in recently. If I recall that I just sent the file in Mail, or that I have it open in a file transfer in Skype, I can easily quit one of the aforementioned apps to close any open processes that might be using the file.

One of the more convenient ways to quit an app is to right-click on the icon in your Dock, and then choose the Quit option:

Quit Mail App

Alternatively, you can also quit an app from the Menu Bar, or by pressing Command ⌘ + Q from the keyboard while the app is open and running in the foreground.

Read more: 6 ways to quit an app on your Mac

After you quit the app you suspect is still using the file you’re trying to delete from your Trash, you can attempt to empty the Trash again. Hopefully it’ll work this time around, but if it doesn’t, then you know it’s another app using the file rather than the one you just quit out of.

Just keep going down the line with apps that are running and continue to try deleting the file.

Keep in mind that any open processes, such as file transfers in instant messenger apps, will be cancelled if you delete the source file. If you have reason to believe this is why the file is too busy to be deleted, then you might want to let your file transfers complete before you delete the file.

I quit everything, but still can’t delete the file

If you have quit everything you can think of, and the file is still being used by OS X, then there is only one other thing you can do: turn your Mac off and on again.

have you tried turning it off and on again gif

This will quit all of OS X’s processes and force your Mac to restart all of its services. Once your Mac is rebooted and you’ve logged back in, you should be able to safely empty your Mac’s Trash without harming anything because the file hasn’t been initialized in any of your apps’ running processes.

Wrapping up

Now that your pesky little file has been removed from your Trash, you should have a nice shiny empty Trash icon in your Mac’s Dock again and the peace of mind that nothing is wasting any storage space on your Mac.

Also read: The difference between emptying the Trash normally and securely

Have you run into this problem before? How did you solve it? Share in the comments below!

  • Share:
  • Follow:
  • Joaquim N.

    That also happens with me all the time and the fastest solution I got was to restart the machine because even after closing all the apps, killing the dock and purging the memory using terminal commands, still doesn’t do the trick.

    90% of the time it happens when I used to install new fonts. Now I hold option and delete them immediately using the menu, instead of sending them to trash.

    • Zzyzxd

      You can simply find which process is locking the file using “lsof” command. And there’s an app for that called “sloth” if you prefer a nicer interface.

      • Joaquim N.

        Why would I waste more time searching for the process that is locking the file? Plus it’s not always only a single file, it may be more so it would take even more time to find the process to each file. It’s so simple to restart and it’s done. It takes no more than 10 seconds to do that on my rMBP.

  • :D

    If I can’t find the app, I use ‘secure empty trash’, which always seems to do the trick. Not sure how to access it on Yosemite since it seems to have changed but Alfred lets you do it if you install the extension.

  • Tim

    Sometimes these files are not in use, no matter how many times you restart your Mac and kill apps it still doesn’t allow you to empty the trash especially if these files are on an external media storage.

  • JustCause

    I thought Macs were supposed to be “PERFECT”?? =)

    • :D

      But this is how it should be. The Mac shouldn’t let you delete the files if they’re still being used. You can override if you want to by ‘secure emptying’ the trash.

    • Johnny T Dane

      JustCause how can you believe anything is perfect? All systems can have errors…

  • If for some reason the Trash stil won’t empty, the ultimate fix is open the Terminal and type

    rm -rf ~/.Trash/*

    (not necessarily the safest procedure though, use at your own risk.)

  • vhgc

    Easier way: Open the trash, select all files in it, right click, select DELETE INMEDIATELY and confirm, that’s it no need to be quitting apps or rebooting mac, files will be permanently deleted no matter which app was using it

  • Gregg

    “Did you reboot your machine?” – the first question asked by the IT guys when calling for support at my previous job. Amazing that it’s still the one basic fix for computers, Mac or Windows…

  • BlackSheep_dsg

    Force empty by holding down the option key

  • MadeInNY

    Often it’s the finder which holds the file open. Sometimes you can free it up by restarting the finder (Option-Click on the finder icon in the dock, and select Relaunch).

  • vhgc

    no more force empty on 10.10.x+, only rigth-click inside the trash with selected files, delete inmediately

  • Wraith

    Another thing that locks the files in the trash can:
    If you temporary disable System integrity protection (rootless) in El Capitan to replace a system file (there a lot of reason to do that) and then you re-enable “SIP” without erase the Trash then you will find that you can’t delete those system files inside the trash, So you will need to disable SIP again to empty the trash.

  • Martynet

    CleanMyMac works the best 🙂

    • Autumn Davis

      Nope. You need to do some serious research on this from some intelligent sources that will help you understand why that is one of the silliest/worst things to install on your mac in the first place.

      • Martynet

        You might be confusing it with a trash like mackeeper and similar… But CleanMyMac 3 fro MacPaw is a good peace of software and one of the best uninstaller out there. I use it to empty the bin and uninstall apps. And Once in 6 moth I use to to clean hdd a bit. Never had an issue.

  • Marcus

    I’ve had this file on my computer for a while and it just won’t go away. It’s a Folder actually. Does anyone know what the solution to the error message below is?

    The Finder can’t complete the operation because some data in “random stuff” can’t be read or written.

    (Error code -36)

  • Christian Tavares

    Use ThashIT app and be happy.

  • zebonaut

    Indeed; just run TrashIT and get on with your day

  • frans daniel

    Long too path error!
    “Long path tool” is very helpful for this problem. You can solve this problem like copy, delete, long path files by using this tool.
    I used to have similar problems too, but after using “long path tool” everything was solved.