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.
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.
- Quit the app that seems to be using the file. If that doesn’t work, quit all running applications.
- Restart your Mac.
- Disable all login items that may be causing the problem and restart your Mac.
- Restart your Mac in Recovery mode (hold down Command-R) while your Mac restarts. Choose 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.
- Click on the Trash icon in the Dock to open it.
- Go to Applications > Utilities and launch Terminal.
- In the Terminal window, type: lsof
- Drag the file you’re trying to delete onto the Terminal window.
- Press Return.
- 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 launch Activity Monitor. Search for the process, select it and press ‘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.
- You can download CleanMyMac X here if you don’t already have it on your Mac.
- Once you’ve installed it, launch CleanMyMac X and choose Trash bins.
- Press Scan.
- Press 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.
- Launch CleanMyMac X and choose Shredder in the sidebar.
- Click Select files.
- Choose the files you want to shred and press Open.
- Press 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.