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
Uninstalling looks inside a maker's folder at the top of a Library
Țugui Dragoș5306e5ffd35d
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swiftindex 5377033a..d515ae24 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift@@ -149,9 +149,10 @@ public struct LeftoverScanner: Sendable {/// Kinds of location where an app's files can sit inside a folder that belongs to somebody else: a crash/// reporter's data folder, macOS's help cache, or a vendor's folder shared by several apps, such as- /// `VST3/Native Instruments` or `/Users/Shared/<Vendor>`. In `/Users/Shared`, everything found is held back.+ /// `VST3/Native Instruments`, `~/Library/<Vendor>` or `/Users/Shared/<Vendor>`. In `/Users/Shared`, everything+ /// found is held back.private static let nestedKinds: Set<SearchLocation.Kind> = [- .applicationSupport, .caches, .logs, .hiddenHomeFiles, .plugIns, .sharedFolder,+ .applicationSupport, .caches, .logs, .hiddenHomeFiles, .plugIns, .sharedFolder, .library,]private static let nestedDepth = 2@@ -341,6 +342,8 @@ public struct LeftoverScanner: Sendable {/// crash report, and an item whose name answers nothing. The identifier says whose such an item is: a claim/// through it replaces a weaker one on the name, and a name it does not back makes the item only possible.private static func match(_ name: String, at url: URL, kind: SearchLocation.Kind, matcher: LeftoverMatcher) -> LeftoverMatch? {+ // A system extension macOS activated is its own to remove: it uninstalls one with the app it came in.+ guard url.pathExtension.lowercased() != "systemextension" else { return nil }let byName = matcher.match(fileName: name, kind: kind, at: url)guard byName == nil || DeclaredIdentifier.outranksTheName(of: url, kind: kind) else { return byName }// `.elsewhere`, so no extension is taken off the identifier as if it were a file name.diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swiftindex 397a119c..9d2f49f1 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift@@ -889,6 +889,55 @@ struct LeftoverScannerTests {#expect(found["home/Library/Preferences"] == nil, "a folder scanned as a location of its own was offered whole")}+ /// A vendor keeps each product's folder inside one of its own at the top of a Library. The product's folder is+ /// found there, a name alone shown but never selected, and the vendor's folder, which holds its other+ /// products, is never offered whole.+ @Test func findsAProductsFolderInsideItsVendorsFolderAtTheTopOfALibrary() async throws {+ let directory = try TemporaryDirectory()+ let app = InstalledApp(+ url: URL(filePath: "/Applications/Hexachord.app"),+ bundleIdentifier: "org.example.hexachord",+ name: "Hexachord"+ )+ try directory.file("home/Library/Example Audio/Hexachord/presets.db", bytes: 64)+ try directory.file("home/Library/Example Audio/org.example.hexachord/state.db", bytes: 64)+ try directory.file("home/Library/Example Audio/Other Product/presets.db", bytes: 64)+ try directory.file("root/Library/Example Audio/Hexachord/samples.db", bytes: 64)++ let scan = await LeftoverScanner(environment: environment(in: directory)).scan(app, installedApps: [app])+ let root = directory.url.path(percentEncoded: false)+ let found = Dictionary(uniqueKeysWithValues: scan.leftovers.map {+ (String($0.url.path(percentEncoded: false).dropFirst(root.count)), $0)+ })++ #expect(Set(found.keys) == [+ "home/Library/Example Audio/Hexachord", "home/Library/Example Audio/org.example.hexachord",+ "root/Library/Example Audio/Hexachord",+ ])+ #expect(found["home/Library/Example Audio/Hexachord"]?.match.heldBack == .namedLikeTheApp)+ #expect(found["root/Library/Example Audio/Hexachord"]?.match.heldBack == .namedLikeTheApp)+ #expect(found["home/Library/Example Audio/org.example.hexachord"]?.match.isRecommended == true)+ }++ /// Apple: "The system automatically uninstalls any system extensions when the user deletes the corresponding+ /// app." The copy macOS activated in `/Library/SystemExtensions` is its own to remove, so it is never listed.+ @Test func neverListsASystemExtensionMacOSRemovesWithItsApp() async throws {+ let directory = try TemporaryDirectory()+ let app = InstalledApp(+ url: URL(filePath: "/Applications/Hexachord.app"),+ bundleIdentifier: "org.example.hexachord",+ name: "Hexachord"+ )+ try directory.file(+ "root/Library/SystemExtensions/5DF88A99/org.example.hexachord.network.systemextension/Contents/Info.plist",+ bytes: 64+ )++ let scan = await LeftoverScanner(environment: environment(in: directory)).scan(app, installedApps: [app])++ #expect(scan.leftovers.isEmpty, "\(scan.leftovers.map(\.url.lastPathComponent))")+ }+/// A folder Apple named for itself, such as `~/Library/Caches/com.apple.python`, belongs to someone else,/// so an app's name found inside it is only a guess.@Test func doesNotTakeANameFoundInsideApplesOwnFolder() async throws {diff --git a/SAFETY.md b/SAFETY.mdindex 8292e487..94957049 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -157,12 +157,14 @@ macOS knows anywhere, such as an older copy in Downloads or one on another disk,the same maker kept outside the Applications folders, such as a Nightly build on another disk, counts like oneinside them. Something matched by the app's name alone inside another app's folder, or one of Apple's, is shown andnever selected, since it is most likely that app's data about this one; so is something matched by name alone at the-top of your home folder or of a Library, where a name is only a guess. A plug-in's name says what it does rather than-who made it, so a plug-in called like the app is selected only when the identifier it declares is the app's or its-maker's: another maker's plug-in with the app's name is never selected. And nothing at all is selected for an app-that would stay: one macOS keeps, one the helper may not move, or one that needs the helper while it cannot act.-When you remove several apps at once and deselect one of them, it stays too: its files leave the selection, those it-shares with the other apps included, and selecting it again brings them back.+top of your home folder or of a Library, or in a maker's folder there, where a name is only a guess. A system+extension the app installed is not listed at all: macOS uninstalls it itself when the app is deleted. A plug-in's+name says what it does rather than who made it, so a plug-in called like the app is selected only when the+identifier it declares is the app's or its maker's: another maker's plug-in with the app's name is never selected.+And nothing at all is selected for an app that would stay: one macOS keeps, one the helper may not move, or one that+needs the helper while it cannot act. When you remove several apps at once and deselect one of them, it stays too:+its files leave the selection, those it shares with the other apps included, and selecting it again brings them+back.Peel itself is listed on its own page with what it keeps, and nothing of it can be selected there or among otherapps. It is removed only by Remove Peel, in Settings, which takes its helper and login item away first.