How to force empty Trash if it has system files?
Question
The question title may seem a duplicate, but this case of mine is unique. This happened because of this problem, which I was able to answer/solve. https://superuser.com/questions/1447825/will-re-installing-mojave-through-internet-recovery-delete-data
And now the system files of the Previous Content
, from the previous installed OS cannot be deleted. It seems the MacOS sees these files as legitimate system files, while in fact, they're not.
I'm using Mojave now btw.
Solution
Try the following:
- Open the Trash, click on it in the Dock.
Open Terminal and type the following command, followed by a space:
sudo rm -rf
Now drag and drop the target folder from the Trash onto the Terminal window.
- Press Enter and type in your (Admin) password and press Enter.
If that doesn't remove the target folder, then make note of its pathname, writing it down on a piece of paper.
- Reboot the Mac to the Recovery HD, pressing ⌘R, and holding it, as the computer starts up after having shut it down.
- Once the macOS Utilities window appears, select Terminal from the Utilities menu.
In Terminal type the following command:
rm -rf /path/to/target/folder
Example:
rm -rf /Volumes/Macintosh\ HD/Users/johndoe/.Trash/Previous\ Content/Devices
- Note: Because this is being done from the Recovery HD, you need to add e.g.
/Volumes/Macintosh\ HD
to the pathname you wrote down earlier.
NOTE: Make sure you type the fully qualified pathname correctly as once you press Enter, that's it, it's gone and cannot be recovered!
- Then type
reboot
and press Enter.
See: About macOS Recovery
OTHER TIPS
I got this issue on Catalina.
If you are trying to delete a file or directory under protection of SIP(System Integrity Protection). You should:
- Enter recovery mode like that answer shows above.
- Then open
Terminal
and typecsrutil disable
to disable SIP - Then restart your original system and delete whatever you want. But be careful to every operation you do with
sudo
!! - Enter recover mode again to enble SIP with
csrutil enable
- Restart you system.