Impossible to Delete Catalina Installers

trash

I've tried to delete the Catalina installer twice – and both instances have become stuck in Trash.

Trying to empty Trash via GUI results in 'operation can't be completed because item is in use` errors. Same thing when I reboot into safe mode and try to empty Trash again.

sudo rm -rf ~filename

gives 'operation not permitted' and then 'directory not empty` errors

ls -laO

show no flags set for the files. So no impediment there.

I've also tried the third-party deletion tool Trash It! on it's most aggressive setting to no success.

https://imgur.com/a/Owza1Gl

This is what the two files look like in Trash. I've never seen those icons before. I'd say it was something installer related but the Big Sur installer deleted without issue. I'm not sure what steps to take next.

Best Answer

If you cannot delete it normally, you can either attempt to find what file is keeping it from being deleted or just delete it from macOS Recovery.

To check for an open file that's in the Trash, from Terminal:

lsof | grep '.Trash'

Or macOS Recovery:

From macOS, running normally, open Terminal and execute the following compound command to reboot to macOS Recovery:

sudo nvram "recovery-boot-mode=unused"; sleep 2; sudo reboot

In macOS Recovery, open Terminal from the Utilities menu and run the following commands:

find /Volumes -maxdepth 4 -type d -name '.Trash'

On my system it returned:

/Volumes/Macintosh HD/Users/me/.Trash
/Volumes/Macintosh HD - Data/Users/me/.Trash

Then change directory to your .Trash directory, either one if two are listed for the target user, delete the .app application bundle, and reboot:

cd '/Volumes/Macintosh HD/Users/me/.Trash'
rm -r *.app
reboot

Or from Terminal in macOS Recovery you can simply run the following compound command and it will delete all .Trash directories and reboot. The .Trash directories will be recreated automatically when logging into your account.

find /Volumes -maxdepth 4 -type d -name '.Trash' -exec rm -r '{}' \; 2>/dev/null; reboot