Deleting a file or folder from a Mac is as easy as hitting the Command + Delete keys, but on rare occasions stubborn files may refuse to be deleted. The oddest warning message displayed in such cases is: “The item ‘filename.xxx' can't be moved to the Trash because it can't be deleted.”
As you can see, this warning message isn't much help here, so it could probably simply be a bug related to Finder. Fortunately, solving this issue is pretty easy: just quit and relaunch Finder and you should be able to finally move that stubborn file to the trash.
To achieve this you'll need to Force Quit the Finder app either by pressing the Command + Shift + Escape keys or Option + Right click on the Finder icon in the Dock.
Why Does Finder Have Issues With That File?
The reason for getting this error may vary, but the most likely cases are as follows:
- The file is in use by an application or system process.
- The file is locked.
- The user doesn't have permission to delete the file.
- The file is damaged or corrupted, and the system is having a hard time finding it on the disk drive.
What to Do If Relaunching Finder Doesn't Solve the Issue
The first thing to do in this situation is to quit all applications that might be using that specific file, even those that you might not think are using it. To do this, simply press the Command + Q keys after activating the application, or open Activity Monitor and kill all the processes you think might be using the file.
If the file is locked, the user doesn't have permission to remove the file or it is damaged, then it is best to first check the file permissions. Select the file and press the Command + I keys or right-click the file and select “Get Info”.
To modify permissions in macOS High Sierra, click on the lock icon located in the bottom right of the Get Info window, at which point you'll need to enter the admin password to initiate the change to the file permissions. In this section you'll see who can read and write the file, and if your user doesn't have this privilege then select that option.
To manually unlock files via Terminal, type the following command:
chflags nouchg [name of file]
After the permissions change, you'll be able to delete the file either by dragging it to the trash or via the Terminal command “sudo rm –R” followed by the location of the file.
Force Empty Trash
On rare occasions you might need to force the trash to be emptied. One method is to quit all active apps and then securely empty the trash by holding down the Command key and right-clicking on the trash icon. Mac users with SSDs won't see the “Secure Delete” option, however.
Advanced users might prefer emptying the trash via a Terminal command. Don't use the very powerful “sudo rm -rf” command, because it will erase everything without warning. Use it only if you know what you are doing. Instead, we recommend using the following, safer method of removing files using Terminal:
- Type “cd ~/.Trash” to change the directory to the trash folder.
- Confirm that you are browsing the right directory by typing “ls”. This will display all files located in the trash.
- Delete the specific file by typing the following command: rm [filename.xxx]. If for some reason that doesn't work, then instead use sudo -rf* [filename.xxx]. This will require the admin password, but the idea is that it will definitely force the selected file to be removed.
As always, use Terminal commands with care and only when you are absolutely sure of what you are doing, otherwise the risk of deleting something significant is pretty high.
Best Mac Optimization Software of 2020
Get the Best Deals on Mac Optimization Software
Stay up to date on the latest tech news and discounts on Mac optimization software with our monthly newsletter.