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
Show what a maker's own folder holds when its last app is uninstalled
Țugui Dragoșab35e8ea1eda
diff --git a/GUIDE.md b/GUIDE.mdindex 8fb960a7..10f433e7 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -36,7 +36,8 @@ and how to get it, [SAFETY.md](SAFETY.md) what it protects, [PRIVACY.md](PRIVACYapp's maker or signing team also uses, waits under Review Before Removing, with what is shared and what Peel heldback. What is named for another app of the same maker that macOS knows, such as a build Xcode keeps, is that app'sand isn't listed, and an identifier a tool gives apps whose makers set none, such as Electron's `com.electron.`- ones, ties no two apps to one maker.+ ones, ties no two apps to one maker. When no other app of its maker is installed, what the maker's own folder+ holds, such as `Application Support/Microsoft` for the last of Microsoft's apps, waits there too.- **What only an administrator can move** stays where it is when Peel's helper isn't allowed to move it from there.Once the app is gone, Peel says how many items stayed, and Orphaned Files lists them under Needs an Administrator,with how to remove them in Finder.diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 18ecde80..d5d9dacd 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -69303,6 +69303,112 @@}}},+ "In its maker’s folder, and no other app of that maker is installed" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ve složce výrobce, od kterého není nainstalovaná žádná jiná aplikace"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Im Ordner des Herstellers, von dem keine andere App installiert ist"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "En la carpeta de su fabricante, y no hay instalada ninguna otra app de ese fabricante"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Dans le dossier de son éditeur, et aucune autre app de cet éditeur n’est installée"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nella cartella del suo produttore, e nessun’altra app di quel produttore è installata"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "開発元のフォルダ内にあり、その開発元のほかのアプリはインストールされていない"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "제작자의 폴더에 있으며, 해당 제작자의 다른 앱이 설치되어 있지 않음"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "In de map van de maker, en er is geen andere app van die maker geïnstalleerd"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "W folderze producenta aplikacji, a żadna inna aplikacja tego producenta nie jest zainstalowana"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Na pasta do fabricante, e nenhum outro app desse fabricante está instalado"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "În dosarul producătorului său și nu este instalată nicio altă aplicație de la acest producător"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "В папке производителя, и других приложений этого производителя не установлено"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "I tillverkarens mapp, och ingen annan app från samma tillverkare är installerad"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Üreticisinin klasöründe ve o üreticinin başka hiçbir uygulaması yüklü değil"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "У папці виробника програми, а інших програм цього виробника не інстальовано"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "位于其厂商的文件夹中,且未安装该厂商的其他App"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "位於其廠商的檔案夾中,且未安裝該廠商的其他App"+ }+ }+ }+ },"In the Trash" : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swiftindex 166c0013..1b8d492a 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift@@ -327,6 +327,7 @@ extension MatchReason {case .managedByTheApp: "managed by the app"case .updaterDownloads: "where its updater keeps its downloads"case .namedByTheApp: "named by the app's own files"+ case .inItsMakersFolder: "in its maker's folder, the maker's last app"}}}diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift b/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swiftindex a15d4ec4..62d5e4fc 100644--- a/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift+++ b/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift@@ -224,6 +224,21 @@ public struct InstalledApp: Sendable, Hashable, Identifiable {for end in words.indices { folders.insert(words[...end].joined()) }return folders.filter { !$0.isEmpty }}++ /// The names of its maker's own folder, normalized: the maker its identifier names (`jetbrains`), the same written+ /// as a domain (`bunkus.org`), and the leading words of the developer its signature names. Never its own names.+ var makersFolderNames: Set<String> {+ var folders: Set<String> = []+ if let vendor = bundleIdentifier.flatMap({ Identifier.vendor(of: $0.lowercased()) }) {+ let parts = vendor.split(separator: ".")+ folders.insert(Naming.normalized(String(parts.last ?? "")))+ folders.insert(Naming.normalized(parts.reversed().joined(separator: ".")))+ }+ let words = (developer ?? "").split { !$0.isLetter && !$0.isNumber }.map { $0.lowercased() }+ for end in words.indices { folders.insert(words[...end].joined()) }+ let own = Set(matchingNames.map(Naming.normalized))+ return folders.filter { $0.count >= 3 && !own.contains($0) }+ }}public enum Architecture: String, Sendable, Hashable, CaseIterable {diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swiftindex ff21bca3..102a22df 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift@@ -31,6 +31,9 @@ public enum MatchReason: String, Sendable, Hashable {case updaterDownloads/// A folder the app's own product file names for its data (`InstalledApp.productFolders`).case namedByTheApp+ /// What the app's maker keeps in a folder of its own, such as `Application Support/JetBrains`, while no other+ /// app of that maker is installed (`LeftoverMatcher.makersFolderNames`).+ case inItsMakersFolder}public enum MatchConfidence: Int, Sendable, Hashable, Comparable {diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swiftindex c4e718c6..b32c71de 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift@@ -55,6 +55,14 @@ struct LeftoverMatcher: Sendable {}}+ /// The names of this app's maker's own folder while no other app of that maker is installed, so what is left in it+ /// may be this app's. None for one of Apple's apps.+ var makersFolderNames: Set<String> {+ guard !target.isApplesOwn, !others.contains(where: { !$0.isACopy(of: target) && $0.isSibling(of: target) })+ else { return [] }+ return target.makersFolderNames+ }+/// The installed apps besides this one that manage the area, and this app's other copies.func others(managing area: SpaceInventory.ManagingApps) -> (apps: [String], copies: [URL]) {let managing = others.filter { area.includes($0.identifier) }@@ -323,7 +331,7 @@ extension LeftoverMatcher {.leadsIntoItsHomebrewReceipt, .managedByTheApp, .updaterDownloads, .namedByTheApp:.identifiercase .name, .namePrefix, .homebrewCask: .name- case .teamIdentifier, .vendorPrefix: .maker+ case .teamIdentifier, .vendorPrefix, .inItsMakersFolder: .maker}}@@ -351,7 +359,7 @@ extension LeftoverMatcher {case .teamIdentifier: 3case .vendorPrefix: 2case .namePrefix: 1- case .homebrewCask: 0+ case .homebrewCask, .inItsMakersFolder: 0}}}@@ -383,6 +391,7 @@ extension LeftoverMatcher {/// None for an app macOS ships, whose words say nothing: `Base` is not AirPort Base Station Agent's.let wordRuns: Set<String>let ownFolderNames: Set<String>+ let makersFolderNames: Set<String>let isApplesOwn: Boollet isASafariWebApp: Boollet updaterFolder: String?@@ -418,6 +427,7 @@ extension LeftoverMatcher {return words.indices.flatMap { start in words.indices[start...].map { words[start...$0].joined() } }})ownFolderNames = app.ownFolderNames+ makersFolderNames = app.makersFolderNamesisApplesOwn = app.isSystemProtected || teamPrefix == Self.appleTeamisASafariWebApp = app.isASafariWebApp// Only electron-builder's `<name>-updater`: any other name could be a folder other programs share.diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swiftindex 4587660c..bdc71dd9 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverScanner.swift@@ -252,12 +252,58 @@ public struct LeftoverScanner: Sendable {exclusions: exclusions, measure: measure, refuses: refuses, installedByApple: installedByApple,limit: nestedFolderLimit)+ let makers = await inItsMakersFolders(+ nobodysFolders, rows: inside.found, of: location, matcher: matcher, home: home, root: root,+ exclusions: exclusions, measure: measure, refuses: refuses+ )return .found(- leftovers + inside.found, cutShort: inside.wasCutShort ? location : nil,+ leftovers + inside.found + makers, cutShort: inside.wasCutShort ? location : nil,unreadable: inside.unreadable.map { SearchLocation(kind: location.kind, url: $0) })}+ private static let makersPlaces: Set<SearchLocation.Kind> = [.applicationSupport, .caches, .logs, .library]++ /// What the maker's own folders hold while the app is the maker's last: the folder whole when no row is in it,+ /// else each item in it that is no row and holds none. Shown, never selected: the maker may have put there what+ /// no app of its own made.+ private static func inItsMakersFolders(+ _ folders: [URL],+ rows: [Leftover],+ of location: SearchLocation,+ matcher: LeftoverMatcher,+ home: String,+ root: String,+ exclusions: Exclusions,+ measure: @escaping Measure,+ refuses: Refuses+ ) async -> [Leftover] {+ let names = matcher.makersFolderNames+ guard !names.isEmpty, makersPlaces.contains(location.kind) else { return [] }+ let rowPaths = rows.map { PathPattern.comparablePath(of: $0.url) }+ var found: [Found] = []+ for folder in folders where names.contains(Naming.folderName(folder.lastPathComponent)) {+ let inside = rowPaths.filter { PathComponents.isPath($0, inside: PathPattern.comparablePath(of: folder)) }+ var items = [folder]+ if !inside.isEmpty {+ let path = folder.path(percentEncoded: false)+ let entries = (try? FileManager.default.contentsOfDirectory(atPath: path)) ?? []+ items = entries.filter { !$0.hasPrefix(".") }.sorted().map { folder.appending(path: $0) }.filter { item in+ !inside.contains { PathComponents.isPath($0, atOrInside: PathPattern.comparablePath(of: item)) }+ }+ }+ let parent = ParentAccess(inside.isEmpty ? location.url : folder)+ for url in items {+ guard !refuses(url.path(percentEncoded: false), home), !exclusions.excludes(url),+ !FileAccess.cannotBeRemoved(url), !isSharedWithTheWholeMac(url, home: home)+ else { continue }+ let match = LeftoverMatch(reason: .inItsMakersFolder, confidence: .possible, sharedWith: [])+ found.append(Found(url: url, match: match, parent: parent, foldersAbove: .itsOwn))+ }+ }+ return await measured(found, kind: location.kind, home: home, root: root, measure: measure)+ }+/// Looks inside the folders not taken as the app's. Only a match strong enough to name the app on its own/// (`likely` or better) is taken, because everything else in there is somebody else's.private static func nested(diff --git a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swiftindex f77eb43e..3d63882e 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/LeftoverScannerTests.swift@@ -1855,6 +1855,41 @@ struct LeftoverScannerTests {#expect(Set(found) == Set(releases))}+ @Test func showsWhatItsMakersFolderHoldsWhenItIsTheMakersLastApp() async throws {+ let directory = try TemporaryDirectory()+ let app = InstalledApp(+ url: URL(filePath: "/Applications/Tidewater Studio.app"), bundleIdentifier: "net.acmecorp.tidewater",+ name: "Tidewater Studio", developer: "AcmeCorp Ltd"+ )+ let paint = InstalledApp(+ url: URL(filePath: "/Applications/Paint.app"), bundleIdentifier: "net.acmecorp.paint", name: "Paint"+ )+ try directory.file("home/Library/Application Support/AcmeCorp/Tidewater Studio/state.db", bytes: 64)+ try directory.file("home/Library/Application Support/AcmeCorp/Licenses/key.dat", bytes: 64)+ try directory.file("home/Library/Caches/AcmeCorp/Updater/feed.xml", bytes: 64)+ let home = directory.url.appending(path: "home/Library").path(percentEncoded: false) + "/"+ func found(beside others: [InstalledApp]) async -> [String: LeftoverMatch] {+ let scan = await LeftoverScanner(environment: environment(in: directory)).scan(+ app, installedApps: [app] + others+ )+ return Dictionary(uniqueKeysWithValues: scan.leftovers.map {+ (String($0.url.path(percentEncoded: false).dropFirst(home.count)), $0.match)+ })+ }++ let alone = await found(beside: [])+ let beside = await found(beside: [paint])++ #expect(Set(alone.keys) == [+ "Application Support/AcmeCorp/Tidewater Studio", "Application Support/AcmeCorp/Licenses", "Caches/AcmeCorp",+ ])+ for path in ["Application Support/AcmeCorp/Licenses", "Caches/AcmeCorp"] {+ #expect(alone[path]?.reason == .inItsMakersFolder && alone[path]?.confidence == .possible, "\(path)")+ #expect(alone[path]?.isRecommended == false)+ }+ #expect(Set(beside.keys) == ["Application Support/AcmeCorp/Tidewater Studio"])+ }+/// A kernel extension an app's driver installed stays in `/Library/Extensions` after the app goes. It is found by/// the identifier it declares and listed, but only an administrator can move it and Peel's helper does not serve/// that folder, so it can never be selected.diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swiftindex ea449ed0..7a492ba0 100644--- a/Peel/Views/Presentation.swift+++ b/Peel/Views/Presentation.swift@@ -22,6 +22,7 @@ extension MatchReason {case .managedByTheApp: "Managed by the app"case .updaterDownloads: "Where the app’s updater keeps its downloads"case .namedByTheApp: "Named by the app’s own files"+ case .inItsMakersFolder: "In its maker’s folder, and no other app of that maker is installed"}}}diff --git a/SAFETY.md b/SAFETY.mdindex fdea62b0..ea4373b5 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -308,7 +308,8 @@ Only matches Peel is `certain` or `likely` about, and only when nothing else ins- **A name alone is a guess.** Something matched by the app's name alone inside a folder named for neither the appnor its maker, such as another app's, one of Apple's, or a command-line tool's, is shown and never selected, since afolder of that name may be that program's own; so is something matched by name alone at the top of your home folder- or of a Library, or in a maker's folder there.+ or of a Library, or in a maker's folder there. What the maker's own folder holds is shown the same way when no other+ app of that maker is installed, since the maker may have put there what none of its apps made.- **A name another app carries is shared with it.** Something matched by the app's name alone is left unselectedwhile another installed app, whoever makes it, holds that name as whole words in its own, as Epic Games Launcherholds Epic: a folder called Epic may be that app's. A word in the name of an app that comes with macOS counts for