Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Let Remove Peel take its own files when another copy of Peel is known
Țugui Dragoșf033e4938440
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/Uninstallation.swift b/Packages/PeelCore/Sources/PeelCore/Removal/Uninstallation.swiftindex 7f348cdb..d631e15e 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/Uninstallation.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/Uninstallation.swift@@ -279,19 +279,21 @@ public struct Uninstallation: Sendable {return urls}- /// What moves when nobody reviews the list, as when Peel removes itself: the app, plus the recommended- /// leftovers that need no helper and are certainly its own or named inside its bundle identifier (a- /// namespace only its maker uses). Empty when the app is excluded, kept by macOS, part of another package, or- /// needs the helper: then nothing should start.+ /// What moves when nobody reviews the list, as when Peel removes itself: the app, plus the leftovers that no+ /// other app shares, nothing holds back, need no helper, and are certainly its own or named inside its bundle+ /// identifier (a namespace only its maker uses). Another copy of the app keeps nothing here, since removing+ /// Peel clears its settings. Empty when the app is excluded, kept by macOS, part of another package, or needs+ /// the helper: then nothing should start.public var unreviewedSelection: [URL] {guard !isExcluded, !app.isSystemProtected, app.enclosingPackage == nil, !appRequiresPrivileges else {return []}let namespace = app.bundleIdentifier.lowercased() + "."let own = scan.leftovers.filter { leftover in- leftover.match.isRecommended && !leftover.requiresPrivileges- && (leftover.match.confidence == .certain- || leftover.url.lastPathComponent.lowercased().hasPrefix(namespace))+ let match = leftover.match+ return match.sharedWith.isEmpty && match.heldBack == nil && match.confidence >= .likely+ && !leftover.requiresPrivileges+ && (match.confidence == .certain || leftover.url.lastPathComponent.lowercased().hasPrefix(namespace))}return order(of: Set(own.map(\.url)).union([app.url]))}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UninstallationTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UninstallationTests.swiftindex 7aab7a79..b51ad68e 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/UninstallationTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/UninstallationTests.swift@@ -154,6 +154,29 @@ struct UninstallationTests {#expect(bulk.suggestedSelection(canUseHelper: true).isSuperset(of: [app.url, own.url, shared.url, other.url]))}+ @Test func removePeelTakesItsFilesWhateverOtherCopyOfPeelIsKnown() {+ let peel = InstalledApp(url: URL(filePath: "/Applications/Peel.app"), bundleIdentifier: "com.tuguidragos.Peel", name: "Peel")+ func file(_ name: String, sharedWith apps: [String] = [], heldBack: HoldBack? = nil) -> Leftover {+ Leftover(+ url: URL(filePath: "/Users/me/Library/Preferences/\(name)"),+ kind: .preferences,+ match: LeftoverMatch(+ reason: .bundleIdentifier, confidence: .certain, sharedWith: apps,+ otherCopies: [URL(filePath: "/Volumes/Peel/Peel.app")], heldBack: heldBack+ ),+ size: 1_000,+ isMeasured: true,+ requiresPrivileges: false+ )+ }+ let settings = file("com.tuguidragos.Peel.plist")+ let shared = file("com.tuguidragos.shared.plist", sharedWith: ["com.example.other"])+ let container = file("com.tuguidragos.Peel.box", heldBack: .holdsDocuments)+ let plan = uninstallation(app: peel, leftovers: [settings, shared, container])++ #expect(plan.unreviewedSelection == [peel.url, settings.url])+ }+/// Peel is removed only from its own Settings, where its helper and login item go first. Its page lists its/// files, but nothing of it can be selected or moved there, alone or among other apps. Remove Peel still takes/// what is certainly its own.