The other day I met her the problem with emptying the trash (Trash) on macos catalina. After doing some tests I found that this problem also occurs on macOS Big Sur if specific error scenarios are created "Trash can't be opened right now because it's being used by another task"
Basically, the user can't empty the trash on the Mac (Empty Trash), Even if some files in it will be deleted, it cannot be completely emptied. Files or folders remain "hanging" somewhere in a task.
“.Trash” can’t be opened right now because it’s being used by another task, such as moving or copying an item or emptying the Trash. Try again when de current task is complete.“ with the "Skip", "Stop" or "Continue" options.
As the error message says, "Trash" is engaged in another operation, and the files inside it cannot be deleted.
In our case the problem arose when I deleted a folder from iCloud Drive. The folder was moved to Trash but he it was not completely downloaded to the Mac. For this reason, the garbage code could not be emptied.
But there are also scenarios in which although Trash seems empty, the option “Empty Trash“ remains active, and the icon indicates that we have files waiting to be deleted. Although we don't see them.
In this case, we will have to go to the system files at the root Trash folders and we delete them manually.
The macOS operating system uses two different roots for the Trash folder. One root is located on the local hard drive, and the other is in iCloud Drive and is intended for files deleted from iCloud. The two are synchronized in Trash.
The solution to the problem is to manually delete the files from the two Trash roots.
1. Go to “Finder” → “Go” → “Go to Folder…” and choose path:
2. The location we get to is the root of the basket and the local garbage. From the hard drive. We manually delete all the contents of this folder.
3. Go to the root of the Trash folder in iCloud Drive:
4. Delete all files in the ".Trash" folder, including the ".DS_Store”
If the manual deletion from "Finder" does not work, the command line is executed in Terminal:
sudo rm -rf ~/Library/Mobile\ Documents/com~apple~clouddocs/.Trash
Restart the operating system, and the Trash icon will no longer show items in the trash.How-to Solve - Trash can't be opened right now because it's being used by another task