Pearcleaner icon indicating copy to clipboard operation
Pearcleaner copied to clipboard

[BUG] Uninstalling an app moves a protected system QuickLook container into Trash, making it permanently undeletable (System Policy deny, survives reboot/sudo/Finder)

Open yxxbc opened this issue 1 month ago • 1 comments

New Issue Checklist

  • [x] I updated Pearcleaner to the latest version and still observe the issue
  • [x] I searched for existing GitHub issues
  • [x] OS Version: 27.0.1 (build 26A434), Mac14,2 (M2)
  • [ ] Pearcleaner Version: ran the latest release straight from the mounted DMG (/Volumes/Pearcleaner), I uninstalled/closed it before noting the exact version — sorry. Repro timestamp below makes it traceable in logs.

Issue:

Uninstalling an app put a system-owned QuickLook container into the Trash, packaged inside the dated bundle folder that Pearcleaner creates (in my case Logic Pro_2026-10-26_19-55-43). That one item can never be deleted by any normal means — every attempt is blocked by the kernel's System Policy layer, so "Empty Trash" permanently fails and the Trash can never be emptied again.

Failing path:

~/.Trash/Logic Pro_2026-10-26_19-55-43/com.apple.quicklook.ThumbnailsAgent-1/com.apple.QuickLook.thumbnailcache

What I already ruled out, so this doesn't get answered with the usual tips:

  • Not the lock flag — Finder reports locked = false.
  • Not POSIX permissions — the parent folder is owned by me, mode drwx------, and I can create/rename/delete other files inside it (verified: touch, rename, rm all succeed there).
  • Not an ACL — I cleared the ACL on ~/.Trash (chmod -N) and the failure is unchanged.
  • Not missing Full Disk Access — the calling terminal has FDA granted and can read ~/Library/Safari, ~/.Trash and everything else.
  • Not fixed by reboot — I rebooted before attempting the deletion.
  • Not root-fixable — sudo rm -rf returns Operation not permitted; osascript ... with administrator privileges does too (the root helper has no FDA and the deny is object-level anyway).
  • Finder can't either — tell application "Finder" to delete item 1 of trash → error -8081 ("must skip some items").
  • Can't be moved out of Trash either — mv to $HOME or /tmp → Permission denied (EACCES), while renaming within ~/.Trash works fine.

Kernel log (this is the real reason, and it's a System Policy deny, i.e. Apple's protected-app-data policy, not a POSIX/ACL problem):

kernel[0] (Sandbox) System Policy: DesktopServicesScriptingHelper(2425) deny(1) file-read-metadata ~/.Trash/Logic Pro_2026-10-26_19-55-43/com.apple.quicklook.ThumbnailsAgent-1/com.apple.QuickLook.thumbnailcache
kernel[0] (Sandbox) System Policy: DesktopServicesScriptingHelper(2425) deny(1) file-write-unlink  ~/.Trash/.../com.apple.QuickLook.thumbnailcache
DesktopServicesScriptingHelper: TCFURLInfo::TranslateRawPOSIXError [1: Operation not permitted] -> -5000 (afpAccessDenied)

Because the denied object is a protected container, even stat/lstat on it returns EPERM — no attribute can be read or cleared, so it is not repairable from userspace.

Steps:

  1. Uninstall an app with Pearcleaner (here: Logic Pro), running from the release DMG mounted at /Volumes/Pearcleaner. Bundle registration logged at 2026-10-26 19:49:16, trashed bundle folder created at 19:55.
  2. Pearcleaner's leftover matching picked up a system QuickLook cache container (com.apple.quicklook.ThumbnailsAgent* / com.apple.QuickLook.thumbnailcache) together with the app's own leftovers and moved everything into the dated Trash bundle.
  3. Try to empty the Trash → fails forever; the dated bundle folder remains, unremovable.

Screenshots:

N/A (terminal transcripts above).

Debug Console

Not captured — Pearcleaner was already closed/removed when the problem surfaced. Available kernel logs are quoted above.

Console Logs

2026-10-26 19:49:16.728 Df lsd[641:9b76d8] com.alienator88.Pearcleaner: Built bundle record for app
2026-10-26 19:49:16.737 Df dmd[666:1546] LaunchServices.applicationRegistered com.alienator88.Pearcleaner / CFBundleDisplayName = Pearcleaner
2026-10-26 22:20:45.797 E  kernel[0:d8e6] (Sandbox) System Policy: DesktopServicesScriptingHelper(2425) deny(1) file-write-unlink /Users/mac/.Trash/Logic Pro_2026-10-26_19-55-43/com.apple.quicklook.ThumbnailsAgent-1/com.apple.QuickLook.thumbnailcache
2026-10-26 22:20:45.797 E  kernel[0:d8e6] (Sandbox) System Policy: DesktopServicesScriptingHelper(2425) deny(1) file-read-metadata /Users/mac/.Trash/.../com.apple.QuickLook.thumbnailcache

What I'm asking for

  1. A way out without going nuclear. I'd rather not boot into Recovery Mode / temporarily disable SIP just to unlink one empty directory. If there is a supported way to make Pearcleaner (or macOS) drop that Trash entry — e.g. a small cleanup helper that runs as a privileged helper with the right entitlement, or guidance on which service to reset — that would be great.
  2. A guard against this in leftover matching. com.apple.* entries under ~/Library/Caches, ~/Library/Containers, ~/Library/Group Containers (especially com.apple.quicklook.*) are system data, not app leftovers; anything under a protected container should be skipped by default rather than moved to the Trash, because once moved it becomes permanently undeletable.
  3. If a version bump already fixed the matching rules, just tell me — I'll happily re-test on 27.0.1 with the current release and report back.

Thanks — otherwise a genuinely great tool, this is the first time it has bitten me.

yxxbc avatar Oct 26 '26 14:10 yxxbc

Digging around while waiting, this looks like a known macOS class of problem, not something specific to my setup:

  • Apple Community, same failure for a trashed com.apple.aned / com.apple.quicklook.ThumbnailsAgent folder: "The only way I found to get rid of it is to boot the Mac in recovery mode and use the terminal to delete it (using rm)". https://discussions.apple.com/thread/252146577
  • Same for com.apple.quicklook.ThumbnailsAgent in the Trash (the usual answers there don't apply to container folders): https://discussions.apple.com/thread/252118678

So the symptom is known and the community answer is always "Recovery Mode". What I'd still love from your side:

  1. Is there a supported/safer route short of Recovery Mode — e.g. an Apple-endorsed way to make the Trash drop an entry whose target is a protected container, or a privileged helper you'd consider shipping for the "delete my own leftovers" case?
  2. Could the leftover scanner skip protected containers by default (com.apple.* under ~/Library/Containers, ~/Library/Group Containers, and QuickLook/ANE caches in particular)? Since these cannot be trashed-and-forgotten, any match there is a permanent Trash blocker.
  3. If useful I can re-run the current release on macOS 27.0.1 and capture the CMD+D debug console during the uninstall, so you can see exactly which rule matched com.apple.quicklook.ThumbnailsAgent-1. Just say which version to use.

Happy to test anything; I'd rather help you fix it than just complain.

yxxbc avatar Oct 26 '26 14:10 yxxbc