How to fix ‘The operation can’t be completed because the item is in use’

Emptying the Trash is one of the most basic procedures in macOS or any operating system with a graphic user interface. We all have our own preferred method of doing it, and when we do, we expect the Trash to empty, and that to be that. At worst, we expect to see a dialogue box asking to confirm we want to empty the Trash.

However, occasionally, an error message appears. That error message is usually ‘The operation can’t be completed because the item is in use.’ In this article, we’ll explain why this error message appears and how to delete a file that’s in use.

Tip

Do you know there are many different ways to put files in the Trash and empty it on the Mac? Here they are: 

  • Drag an item to the Bin.
  • Press Shift and drag the pointer over multiple items, then drag them to the Bin.
  • Command-click on multiple non-adjacent items, then drag them to the Bin. 
  • Do any of the above to select items, then right-click on the selection and choose Move to Bin. 
 

To empty the Trash: 

  • Go to the Finder, click on the Finder menu and choose Empty Bin. 
  • In the Finder, press Command-Shift-Delete. 
  • Right-click on the Trash in the Dock and choose Empty Bin.

What does ‘The operation can’t be completed because the item is in use’ mean?

This error message usually appears when a background task or application currently open is using the file. However, it can also appear when macOS thinks the file is in use. Often, the file causing the problem is an obscure system file you don’t recognize and didn’t manually drag to the Trash.

How to force delete the Trash on your Mac

Try these steps in order, after each one, try emptying the Trash.

  1. Quit the app that seems to be using the file. If that doesn’t work, quit all running applications.
  2. Restart your Mac.
  3. Disable all login items that may be causing the problem and restart your Mac.
  4. Boot your Mac into recovery mode (find the steps here). Select Disk Utility in macOS Utilities and use that to repair your startup disk.

How to delete a file using Terminal

If none of the steps above work, the next option is to use Terminal to find out which files are currently in use or at least which files your Mac thinks are in use. The Terminal command lsof is short for ‘list all open files’ and should give you a clue as to why the file in the Trash can’t be deleted.

  1. Click on the Trash icon in the Dock to open it.
  2. Go to Applications > Utilities and open Terminal.
  3. In the Terminal window, type lsof
  4. Drag the file you’re trying to delete onto the Terminal window.
  5. Press Return.
  6. You will now see a list of running processes that are using the file.

You should be able to identify the process that’s preventing the Trash from being emptied. If it’s a background process, go to Applications > Utilities and open Activity Monitor. Search for the process, select it and click ‘Quit Process’ in the toolbar.

How to empty Trash bins easily

You may not know it, but each volume has its own Trash. So, when you drag a file stored on an external disk or USB stick to the Trash, that Trash bin is specific to the external disk or USB stick. If you unmount or eject the disk, the files will disappear from the Trash. Plug it back in, and they will go back into the Trash until you empty it. Applications, like email clients, can also have their own trash. The quickest way to empty all the trash bins on your Mac is to use the Trash Bins module in CleanMyMac X. This empties all the trash on your Mac and can get around some Finder errors. Here’s how to use it.

CleanMyMac X - Trash Bins scan completed

  1. You can download CleanMyMac X here if you don’t already have it on your Mac.
  2. Once you’ve installed it, open CleanMyMac X and select Trash bins.
  3. Click Scan.
  4. Click Empty.

CleanMyMac X also has a file shredder. When you drag a file to the Trash and empty it, your Mac’s file directory is updated to make the space occupied by the file available for use. Eventually, the file will be overwritten. But in the meantime, it’s still sitting there and can be recovered. If the file contains private data, that’s not an ideal situation. The file shredder in CleanMyMac X securely deletes files by overwriting them immediately.

  1. Open CleanMyMac X and choose Shredder in the sidebar.
  2. Click Select files.
  3. Select the files you want to shred and click Open.
  4. Click Shred.

If you encounter an error when you try to empty the Trash on your Mac, it’s likely to be because a file in the Trash is in use by an application or process. Follow the steps above to empty the Trash and delete the file or identify the process causing the problem and close it.

Laptop with CleanMyMac
CleanMyMac X

Your Mac. As good as new.