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
List Xcode's simulators when Xcode is uninstalled
Țugui Dragoș1c58f7f17b65
diff --git a/GUIDE.md b/GUIDE.mdindex c0b44e94..437302cb 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -20,7 +20,7 @@ and how to get it, [SAFETY.md](SAFETY.md) what it protects, [PRIVACY.md](PRIVACY- **What may exist nowhere else is left to you.** A folder holding a crypto wallet, a signing key, a passworddatabase, or a repository is shown with its reason and not selected, and so is a place where an app keeps whatmay exist only on this Mac, such as local mail, message history, sign-in codes, VPN connections, a game's saves, a- database, or an app's own backups.+ database, or an app's own backups. Uninstalling Xcode lists the simulators it made the same way.- **Shared or guessed, never selected.** A file another installed app also uses is shown but never selected. WhatPeel only guesses at, from the start of a name or an identifier the app's maker or signing team also uses, waitsunder Review Before Removing.@@ -108,7 +108,8 @@ they install, so choosing one, or a folder inside one, is refused.**Space:** what's taking up room, and which app it belongs to. What an app manages itself, such as Xcode'ssimulators, Docker's disk, Rust's toolchains, or Android's NDK versions, Space measures and leaves to that tool,with the command that frees it, when there is one, for you to copy into Terminal: Peel never runs it, since it-deletes for good. In the Library at the top of the disk, Space also lists the caches and logs apps keep for every+deletes for good. Once Xcode is gone, the Simulators area says to install it again before using its settings. In the+Library at the top of the disk, Space also lists the caches and logs apps keep for everyaccount, and the crash reports macOS keeps. Those an administrator owns go through Peel's helper, and what macOSkeeps there for its own services is never listed. In your own Logs, the folder macOS saves crash reports in stays andonly the reports are offered, since macOS can't make that folder again. Nothing is selected for you: Selectdiff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 7a9417af..e0276b73 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -56756,6 +56756,113 @@}}},+ "Install Xcode again, then Xcode > Settings > Components" : {+ "comment" : "Xcode > Settings > Components are Xcode's own menus, which are English in every language.",+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Znovu nainstalujte Xcode a pak zvolte Xcode > Settings > Components"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Installiere Xcode erneut und wähle dann Xcode > Settings > Components"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Vuelve a instalar Xcode y luego Xcode > Settings > Components"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Réinstallez Xcode, puis Xcode > Settings > Components"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Installa di nuovo Xcode, poi Xcode > Settings > Components"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Xcodeを再インストールしてから、Xcode > Settings > Componentsと選択してください"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Xcode를 다시 설치한 다음 Xcode > Settings > Components"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Installeer Xcode opnieuw en kies daarna Xcode > Settings > Components"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Zainstaluj ponownie Xcode, a potem wybierz Xcode > Settings > Components"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Instale o Xcode novamente e depois Xcode > Settings > Components"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Instalați Xcode din nou, apoi Xcode > Settings > Components"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Установите Xcode снова, затем Xcode > Settings > Components"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Installera Xcode igen och välj sedan Xcode > Settings > Components"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Xcode’u yeniden yükleyin, ardından Xcode > Settings > Components"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Інсталюйте Xcode знову, а потім Xcode > Settings > Components"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "重新安装Xcode,然后前往Xcode > Settings > Components"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "重新安裝Xcode,然後選擇Xcode > Settings > Components"+ }+ }+ }+ },"Install and set up" : {"localizations" : {"cs" : {@@ -71367,6 +71474,112 @@}}},+ "Managed by the app" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Spravováno aplikací"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Von der App verwaltet"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Lo gestiona la app"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Géré par l’app"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Gestito dall’app"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "アプリによる管理"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "앱에서 관리됨"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Beheerd door de app"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Zarządzane przez aplikację"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Gerenciado pelo app"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Gestionat de aplicație"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Управляется приложением"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hanteras av appen"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Uygulama tarafından yönetiliyor"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Керується програмою"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "由App管理"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "由App管理"+ }+ }+ }+ },"Marked as a cache by the tool that made it" : {"localizations" : {"cs" : {@@ -90258,6 +90471,112 @@}}},+ "Not selected: this holds the app’s simulators, with the apps installed in them and their data, which may exist only on this Mac. Once the Trash is emptied, they’re gone for good unless you have a backup." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nevybráno: obsahuje simulátory aplikace i s aplikacemi v nich nainstalovanými a jejich daty, které mohou existovat jen v tomto Macu. Jakmile se koš vysype, budou trvale ztraceny, pokud nemáte zálohu."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nicht ausgewählt: Dieses Objekt enthält die Simulatoren der App mit den darin installierten Apps und ihren Daten, die es möglicherweise nur auf diesem Mac gibt. Sobald der Papierkorb entleert ist, sind sie endgültig verloren, sofern du kein Backup hast."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sin seleccionar: contiene los simuladores de la app, con las apps instaladas en ellos y sus datos, que puede que solo existan en este Mac. En cuanto se vacíe la papelera, se perderán definitivamente, salvo que tengas una copia de seguridad."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Non sélectionné : il contient les simulateurs de l’app, avec les apps qui y sont installées et leurs données, qui n’existent peut-être que sur ce Mac. Une fois la corbeille vidée, ils sont perdus définitivement, sauf si vous en avez une sauvegarde."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Non selezionato: contiene i simulatori dell’app, con le app installate al loro interno e i relativi dati, che potrebbero esistere solo su questo Mac. Una volta svuotato il Cestino, sono persi definitivamente, a meno che tu non abbia un backup."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未選択: ここには、このアプリのシミュレータと、その中にインストールされているアプリおよびそのデータが含まれており、このMacにしか存在しない可能性があります。ゴミ箱を空にすると、バックアップがない限り、二度と取り戻せなくなります。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "선택되지 않음: 앱의 시뮬레이터와 그 안에 설치된 앱 및 해당 데이터가 들어 있으며, 이는 이 Mac에만 있을 수 있습니다. 휴지통을 비우면 백업이 없는 한 영구적으로 사라집니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Niet geselecteerd: dit bevat de simulators van de app, met de daarin geïnstalleerde apps en hun gegevens, die misschien alleen op deze Mac staan. Zodra de prullenmand is geleegd, zijn ze definitief weg, tenzij je een back-up hebt."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nie zaznaczono: zawiera symulatory aplikacji, które mogą istnieć tylko na tym Macu, wraz z zainstalowanymi w nich aplikacjami i ich danymi. Po opróżnieniu Kosza przepadną na zawsze, chyba że masz backup."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Não selecionado: este item contém os simuladores do app, com os apps instalados neles e os dados deles, que podem existir só neste Mac. Depois que o Lixo for esvaziado, eles se perdem definitivamente, a menos que você tenha um backup."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Neselectat: acest articol conține simulatoarele aplicației, cu aplicațiile instalate în ele și datele lor, care pot exista doar pe acest Mac. După golirea Coșului, acestea se pierd definitiv, dacă nu aveți un backup."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не выбрано: здесь хранятся симуляторы приложения с установленными в них приложениями и их данными, и, возможно, они есть только на этом Mac. После очистки Корзины они будут потеряны безвозвратно, если у Вас нет резервной копии."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Inte markerad: den innehåller appens simulatorer, med apparna som är installerade på dem och deras data, som kanske bara finns på den här datorn. När papperskorgen har tömts är de borta för alltid, om du inte har en säkerhetskopia."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Seçilmedi: bu, içlerinde yüklü uygulamalar ve bunların verileriyle birlikte, uygulamanın yalnızca bu Mac’te bulunabilecek simülatörlerini içerir. Çöp Sepeti boşaltıldığında, yedeklemeniz yoksa bunlar kalıcı olarak gider."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не вибрано: тут зберігаються симулятори програми разом з інстальованими в них програмами та їхніми даними, які можуть існувати лише на цьому Mac. Коли Смітник буде очищено, їх буде втрачено назавжди, якщо у вас немає резервної копії."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未选择:此处存有该App的模拟器,以及安装在其中的App及其数据,这些内容可能仅存在于这台Mac上。一旦清倒废纸篓,除非你有备份,否则它们将永久丢失。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未選取:其中存有此App的模擬器,連同模擬器中安裝的App及其資料,這些內容可能只存在於這部Mac上。一旦清空「垃圾桶」,除非你有備份,否則它們就會永久消失。"+ }+ }+ }+ },"Not selected: this holds what you made with the app, such as saved games, databases, or the app’s own backups, which may exist only on this Mac. Once the Trash is emptied, it’s gone for good unless you have another copy." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swiftindex 95c67294..63690bd1 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift@@ -274,6 +274,7 @@ extension MatchReason {case .homebrewReceipt: "Homebrew receipt"case .leadsIntoItsHomebrewReceipt: "leads into the Homebrew receipt"case .homebrewCask: "Homebrew cask"+ case .managedByTheApp: "managed by the app"}}}@@ -329,6 +330,7 @@ extension HoldBack {case .holdsVPNConnections: "holds VPN connections that may exist only on this Mac"case .holdsWorkMadeWithTheApp:"holds what you made with the app, such as saved games, databases, or its backups, that may exist only here"+ case .holdsSimulators: "holds the app's simulators, with the apps installed in them and their data"case .holdsKeys: "holds a wallet or a key Peel protects"case .holdsWorkKeptInACache: "holds work an app keeps nowhere else, such as an editor's local history"case .insideAnotherAppsFolder: "inside another app's folder"diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swiftindex cae80652..cc0002f2 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift@@ -23,6 +23,9 @@ public enum MatchReason: String, Sendable, Hashable {case leadsIntoItsHomebrewReceipt/// The app's Homebrew cask lists this path in its uninstall or zap stanza.case homebrewCask+ /// What an area the app manages keeps in the home folder, such as the simulators Xcode makes+ /// (`SpaceInventory.Definition.managedBy`).+ case managedByTheApp}public enum MatchConfidence: Int, Sendable, Hashable, Comparable {@@ -77,6 +80,8 @@ public enum HoldBack: String, Sendable, Hashable {/// What the person made with the app, such as saved games, databases, or the app's own backups, that may exist/// only on this Mac (`KeptOnlyHere`).case holdsWorkMadeWithTheApp+ /// Simulators, with the apps installed in them and their data, which may exist only on this Mac.+ case holdsSimulators/// A wallet or a key `ProtectedData` names is inside, and `RemovalGuard` refuses to move the folder around it.case holdsKeys/// Work kept nowhere else is inside a cache folder, such as an editor's local history of the person's files, anddiff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swiftindex 88da93af..514e6ecc 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/LeftoverMatcher.swift@@ -37,6 +37,15 @@ struct LeftoverMatcher: Sendable {.map(\.reference).sorted()}+ /// 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) }+ return (+ Set(managing.filter { !$0.isACopy(of: target) }.map(\.reference)).sorted(),+ managing.filter { $0.isACopy(of: target) }.map(\.url)+ )+ }+/// This app's claim on the item called `fileName` in a location of `kind`, found at `url` when the caller knows it.func match(fileName: String, kind: SearchLocation.Kind, at url: URL? = nil) -> LeftoverMatch? {let key = Self.key(from: fileName, kind: kind)@@ -248,7 +257,7 @@ extension LeftoverMatcher {family = switch reason {case .bundleIdentifier, .embeddedBundleIdentifier, .applicationGroup, .bundleIdentifierPrefix,.launchdJob, .linksToTheApp, .nativeMessagingHost, .installerReceipt, .homebrewReceipt,- .leadsIntoItsHomebrewReceipt:+ .leadsIntoItsHomebrewReceipt, .managedByTheApp:.identifiercase .name, .namePrefix, .homebrewCask: .namecase .teamIdentifier, .vendorPrefix: .maker@@ -271,7 +280,7 @@ extension LeftoverMatcher {// A job's or a manifest's program, or a link's target, lies inside the app's bundle, which no other app// can share.case .launchdJob, .linksToTheApp, .nativeMessagingHost, .leadsIntoItsHomebrewReceipt: 8- case .bundleIdentifier, .installerReceipt, .homebrewReceipt: 7+ case .bundleIdentifier, .installerReceipt, .homebrewReceipt, .managedByTheApp: 7case .embeddedBundleIdentifier, .applicationGroup: 6case .bundleIdentifierPrefix: 5case .name: 4diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/Uninstallation.swift b/Packages/PeelCore/Sources/PeelCore/Removal/Uninstallation.swiftindex 854c8354..39659336 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/Uninstallation.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/Uninstallation.swift@@ -70,6 +70,9 @@ public struct Uninstallation: Sendable {environment: environment))+ scan = scan.adding(+ await leftoversOfManagedAreas(of: app, matcher: matcher, exclusions: exclusions, environment: environment)+ )scan = scan.adding(await homebrewReceipt(of: app,@@ -100,6 +103,39 @@ public struct Uninstallation: Sendable {)}+ /// What the areas `app` manages keep in the home folder, such as Xcode's simulators, which stay when the app goes.+ static func leftoversOfManagedAreas(+ of app: InstalledApp,+ matcher: LeftoverMatcher,+ exclusions: Exclusions,+ environment: SearchEnvironment,+ areas: [SpaceInventory.Definition] = SpaceInventory.definitions+ ) async -> [Leftover] {+ let home = environment.homeDirectory+ var leftovers: [Leftover] = []+ for area in areas {+ guard let managedBy = area.managedBy, managedBy.includes(app.bundleIdentifier) else { continue }+ let others = matcher.others(managing: managedBy)+ for url in area.placesInTheHome(home) where url.isRealFolder && !exclusions.excludes(url) {+ let leftover = await LeftoverScanner.leftover(+ at: url,+ kind: place(of: url, in: environment).kind,+ match: LeftoverMatch(+ reason: .managedByTheApp,+ confidence: .certain,+ sharedWith: others.apps,+ otherCopies: others.copies+ ),+ parent: ParentAccess(url.deletingLastPathComponent()),+ home: home.path(percentEncoded: false)+ )+ .heldBack(managedBy.leftBehind)+ leftovers.append(exclusions.holds(url) ? leftover.heldBack(.holdsAnExclusion) : leftover)+ }+ }+ return leftovers+ }+/// The installer receipt files that belong to `app`. The receipt is the only reason macOS still counts the/// package as installed once the app is gone, and it is two small files the Trash can give back. What the/// package installed elsewhere is left to the Package Receipts page, which weighs each item on its own.diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swiftindex 20c35ce7..962948ef 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceReport.swift@@ -36,6 +36,9 @@ public struct SpaceItem: Sendable, Hashable, Identifiable {/// The commands that free an area Peel leaves alone, as its tool's documentation gives them. Peel shows them to/// copy and never runs them: they delete for good.public var commands: [String] = []+ /// True when the apps that make and clear this area are all gone from this Mac, so its words can't send the+ /// person to them.+ public var managingAppIsMissing = falsepublic var isReadOnly: Bool {if case .readOnly = handling { true } else { false }@@ -87,6 +90,23 @@ public enum SpaceInventory {}}+ /// The apps that make and clear an area, as the area's words in the app name them, and why what the area keeps+ /// in the home folder is only offered for review when one of them is uninstalled.+ struct ManagingApps: Sendable {+ let identifiers: [String]+ let leftBehind: HoldBack++ func includes(_ identifier: String?) -> Bool {+ guard let identifier = identifier?.lowercased() else { return false }+ return identifiers.contains { $0.lowercased() == identifier }+ }++ /// Whether one of them is on this Mac, wherever it is, outside a Trash.+ var oneIsOnThisMac: Bool {+ identifiers.contains { !AppInspector.applicationURLs(forBundleIdentifier: $0).isEmpty }+ }+ }+struct Definition: Sendable {let id: Stringlet category: SpaceItem.Category@@ -104,6 +124,7 @@ public enum SpaceInventory {var leavesMacOSsOwn = falsevar onlyFilesIn: [String] = []var commands: [Command] = []+ var managedBy: ManagingApps?/// Each of `paths` on this Mac: one that starts with `/` is under `root`, the rest are in `home`.func urls(home: URL, root: URL, userCache: URL?) -> [URL] {@@ -114,6 +135,11 @@ public enum SpaceInventory {} + (isTheUserCacheFolder ? [userCache].compactMap(\.self) : [])}+ /// Each of `paths` in the home folder: those outside it belong to every account on the Mac.+ func placesInTheHome(_ home: URL) -> [URL] {+ paths.filter { !$0.hasPrefix("/") }.map { home.appending(path: $0, directoryHint: .isDirectory) }+ }+/// True when the area's size is what it offers, child by child, rather than its places measured whole: one/// place may sit inside another of its own, which would count twice.var measuresWhatItOffers: Bool { leavesMacOSsOwn || !onlyFilesIn.isEmpty }@@ -131,6 +157,9 @@ public enum SpaceInventory {/// live in the app, because this package has no string catalog.public static var definitionIdentifiers: [String] { definitions.map(\.id) }+ /// The identifier of every area its apps manage, which the app gives words for when those apps are gone.+ public static var managedAreaIdentifiers: [String] { definitions.filter { $0.managedBy != nil }.map(\.id) }+static let definitions: [Definition] = [Definition(id: "simulators",@@ -140,7 +169,10 @@ public enum SpaceInventory {commands: [Command("xcrun simctl runtime delete --outdated", needs: .simctlRuntimeOption("--outdated")),Command("xcrun simctl delete unavailable", needs: .simctl),- ]+ ],+ // Apple's "Managing your simulated and physical devices in Device Hub": simulators are made and removed in+ // Xcode, whose first launch installs CoreSimulator, which keeps them in the home folder.+ managedBy: ManagingApps(identifiers: ["com.apple.dt.Xcode"], leftBehind: .holdsSimulators)),Definition(id: "android-sdk",@@ -490,17 +522,7 @@ public enum SpaceInventory {}let help = await simctlHelplet items = measured.filter { $0.size.map { $0 >= minimumSize } ?? true }.map { definition, urls, size in- SpaceItem(- id: definition.id,- category: definition.category,- urls: urls,- size: size,- handling: definition.handling,- heldBack: definition.heldBack,- leavesMacOSsOwn: definition.leavesMacOSsOwn,- onlyFilesIn: definition.onlyFilesIn(home: home, root: root),- commands: definition.commands.filter { $0.isKnown(simctlRuntimeHelp: help) }.map(\.line)- )+ item(definition, urls: urls, size: size, home: home, root: root, simctlRuntimeHelp: help)}return SpaceReport(@@ -515,6 +537,28 @@ public enum SpaceInventory {)}+ static func item(+ _ definition: Definition,+ urls: [URL],+ size: Int64?,+ home: URL,+ root: URL,+ simctlRuntimeHelp help: String?+ ) -> SpaceItem {+ SpaceItem(+ id: definition.id,+ category: definition.category,+ urls: urls,+ size: size,+ handling: definition.handling,+ heldBack: definition.heldBack,+ leavesMacOSsOwn: definition.leavesMacOSsOwn,+ onlyFilesIn: definition.onlyFilesIn(home: home, root: root),+ commands: definition.commands.filter { $0.isKnown(simctlRuntimeHelp: help) }.map(\.line),+ managingAppIsMissing: definition.managedBy.map { !$0.oneIsOnThisMac } ?? false+ )+ }+static func purgeableSpace(of url: URL) -> Int64? {let values = try? url.resourceValues(forKeys: [.volumeAvailableCapacityForImportantUsageKey, .volumeAvailableCapacityKey,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swiftindex 48115043..35bed618 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SpaceInventoryTests.swift@@ -435,6 +435,50 @@ struct SpaceInventoryTests {}}+ @Test func xcodeManagesTheSimulatorsAndLeavesThemForReview() throws {+ let simulators = try #require(SpaceInventory.definitions.first { $0.id == "simulators" })+ let home = URL(filePath: "/Users/someone/", directoryHint: .isDirectory)++ let managedBy = try #require(simulators.managedBy)+ #expect(managedBy.identifiers == ["com.apple.dt.Xcode"])+ #expect(managedBy.leftBehind == .holdsSimulators)+ #expect(simulators.placesInTheHome(home) == [+ home.appending(path: "Library/Developer/CoreSimulator/Devices", directoryHint: .isDirectory)+ ])+ #expect(SpaceInventory.managedAreaIdentifiers == ["simulators"])+ }++ @Test func knowsWhetherAnAppThatManagesAnAreaIsOnThisMac() {+ let gone = SpaceInventory.ManagingApps(identifiers: ["org.example.gone"], leftBehind: .holdsSimulators)+ let finder = SpaceInventory.ManagingApps(+ identifiers: ["org.example.gone", "com.apple.finder"], leftBehind: .holdsSimulators+ )++ #expect(!gone.oneIsOnThisMac)+ #expect(finder.oneIsOnThisMac)+ #expect(finder.includes("COM.apple.Finder"))+ #expect(!finder.includes("com.apple.finder.helper"))+ #expect(!finder.includes(nil))+ }++ @Test func saysWhenTheAppsThatManageAnAreaAreGone() {+ let home = URL(filePath: "/Users/someone/", directoryHint: .isDirectory)+ func item(managedBy identifiers: [String]?) -> SpaceItem {+ let area = SpaceInventory.Definition(+ id: "machines",+ category: .virtualMachines,+ paths: ["Machines"],+ handling: .readOnly,+ managedBy: identifiers.map { .init(identifiers: $0, leftBehind: .holdsWorkMadeWithTheApp) }+ )+ return SpaceInventory.item(area, urls: [], size: 0, home: home, root: home, simctlRuntimeHelp: nil)+ }++ #expect(item(managedBy: ["org.example.gone"]).managingAppIsMissing)+ #expect(!item(managedBy: ["com.apple.finder"]).managingAppIsMissing)+ #expect(!item(managedBy: nil).managingAppIsMissing)+ }+@Test func showsRustToolchainsAndAndroidNDKsForTheirToolsToRemove() async throws {let directory = try TemporaryDirectory()try directory.file(".rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc", bytes: 400_000)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UninstallationTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UninstallationTests.swiftindex b1a9f6d0..ff9002e1 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/UninstallationTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/UninstallationTests.swift@@ -981,6 +981,147 @@ struct UninstallationTests {#expect(found.isEmpty)}++ private func machines(managedBy identifiers: [String], paths: [String] = ["Library/Example/Machines"])+ -> SpaceInventory.Definition {+ SpaceInventory.Definition(+ id: "machines",+ category: .virtualMachines,+ paths: paths + ["/Library/Example/Shared"],+ handling: .readOnly,+ managedBy: .init(identifiers: identifiers, leftBehind: .holdsWorkMadeWithTheApp)+ )+ }++ private func leftoversOfManagedAreas(+ of app: InstalledApp,+ among installedApps: [InstalledApp],+ exclusions: Exclusions = .none,+ areas: [SpaceInventory.Definition],+ environment: SearchEnvironment+ ) async -> [Leftover] {+ let matcher = await LeftoverScanner(environment: environment, exclusions: exclusions)+ .matcher(for: app, installedApps: installedApps)+ return await Uninstallation.leftoversOfManagedAreas(+ of: app, matcher: matcher, exclusions: exclusions, environment: environment, areas: areas+ )+ }++ @Test func listsWhatAnAreaTheAppManagesKeepsInTheHomeForReview() async throws {+ let directory = try TemporaryDirectory()+ let home = try directory.directory("home")+ try directory.file("home/Library/Example/Machines/one/disk.img", bytes: 4_096)+ try directory.file("root/Library/Example/Shared/runtime.img", bytes: 4_096)+ let app = InstalledApp(+ url: try directory.directory("home/Applications/Machines.app"),+ bundleIdentifier: "org.example.machines",+ name: "Machines"+ )+ let environment = SearchEnvironment(homeDirectory: home, rootDirectory: directory.url.appending(path: "root"))++ let found = await leftoversOfManagedAreas(+ of: app, among: [app], areas: [machines(managedBy: ["org.example.machines"])], environment: environment+ )++ let leftover = try #require(found.first)+ #expect(found.count == 1, "the place every account shares was offered")+ #expect(PathPattern.comparablePath(of: leftover.url) == PathPattern.comparablePath(+ of: home.appending(path: "Library/Example/Machines")+ ))+ #expect(leftover.match.reason == .managedByTheApp)+ #expect(leftover.match.confidence == .certain)+ #expect(leftover.match.heldBack == .holdsWorkMadeWithTheApp)+ #expect(!leftover.match.isRecommended)+ #expect(leftover.isMeasured && leftover.size >= 4_096)+ }++ @Test func anotherCopyOrAnotherAppThatManagesTheAreaUsesItToo() async throws {+ let directory = try TemporaryDirectory()+ let home = try directory.directory("home")+ try directory.file("home/Library/Example/Machines/one/disk.img", bytes: 4_096)+ func app(_ name: String, _ identifier: String) throws -> InstalledApp {+ InstalledApp(+ url: try directory.directory("home/Applications/\(name).app"), bundleIdentifier: identifier, name: name+ )+ }+ let machinesApp = try app("Machines", "org.example.machines")+ let copy = try app("Machines Beta", "org.example.machines")+ let fleet = try app("Fleet", "org.example.fleet")+ let bystander = try app("Notes", "org.example.notes")+ let environment = SearchEnvironment(homeDirectory: home, rootDirectory: directory.url.appending(path: "root"))++ let found = await leftoversOfManagedAreas(+ of: machinesApp,+ among: [machinesApp, copy, fleet, bystander],+ areas: [machines(managedBy: ["org.example.machines", "org.example.fleet"])],+ environment: environment+ )++ let leftover = try #require(found.first)+ #expect(leftover.match.sharedWith == ["org.example.fleet"])+ #expect(leftover.match.otherCopies.map(PathPattern.comparablePath(of:)) == [+ PathPattern.comparablePath(of: copy.url)+ ])+ }++ @Test func leavesAnAreaToTheAppsThatManageItAndToExclusions() async throws {+ let directory = try TemporaryDirectory()+ let home = try directory.directory("home")+ let disk = try directory.file("home/Library/Example/Machines/one/disk.img", bytes: 4_096)+ let place = disk.deletingLastPathComponent().deletingLastPathComponent()+ let app = InstalledApp(+ url: try directory.directory("home/Applications/Machines.app"),+ bundleIdentifier: "org.example.machines",+ name: "Machines"+ )+ let notes = InstalledApp(+ url: try directory.directory("home/Applications/Notes.app"),+ bundleIdentifier: "org.example.notes",+ name: "Notes"+ )+ let environment = SearchEnvironment(homeDirectory: home, rootDirectory: directory.url.appending(path: "root"))+ let area = machines(managedBy: ["org.example.machines"])++ let forAnotherApp = await leftoversOfManagedAreas(+ of: notes, among: [app, notes], areas: [area], environment: environment+ )+ let excluded = await leftoversOfManagedAreas(+ of: app, among: [app], exclusions: Exclusions(paths: [place]), areas: [area], environment: environment+ )+ let holdingAnExclusion = await leftoversOfManagedAreas(+ of: app, among: [app], exclusions: Exclusions(paths: [disk]), areas: [area], environment: environment+ )+ let missing = await leftoversOfManagedAreas(+ of: app,+ among: [app],+ areas: [machines(managedBy: ["org.example.machines"], paths: ["Library/Example/Nothing"])],+ environment: environment+ )++ #expect(forAnotherApp.isEmpty)+ #expect(excluded.isEmpty)+ #expect(holdingAnExclusion.map(\.match.heldBack) == [.holdsAnExclusion])+ #expect(missing.isEmpty)+ }++ @Test func uninstallingXcodeListsItsSimulatorsUnselected() async throws {+ let directory = try TemporaryDirectory()+ let home = try directory.directory("home")+ try directory.file("home/Library/Developer/CoreSimulator/Devices/device_set.plist", bytes: 351)+ let xcode = InstalledApp(+ url: try directory.directory("home/Applications/Xcode.app"),+ bundleIdentifier: "com.apple.dt.Xcode",+ name: "Xcode"+ )+ let environment = SearchEnvironment(homeDirectory: home, rootDirectory: directory.url.appending(path: "root"))++ let plan = await Uninstallation.prepare(xcode, installedApps: [xcode], environment: environment)++ let devices = try #require(plan.scan.leftovers.first { $0.url.lastPathComponent == "Devices" })+ #expect(devices.match.reason == .managedByTheApp)+ #expect(devices.match.heldBack == .holdsSimulators)+ #expect(!plan.suggestedSelection(canUseHelper: true).contains(devices.url))+ }}/// Anything Peel selects on its own has to pass the guard, and the helper when it needs one, or it would bediff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swiftindex 4caef319..84c2df8c 100644--- a/Peel/Views/Presentation.swift+++ b/Peel/Views/Presentation.swift@@ -19,6 +19,7 @@ extension MatchReason {case .homebrewReceipt: "The app’s Homebrew receipt"case .leadsIntoItsHomebrewReceipt: "Leads into the app’s Homebrew receipt"case .homebrewCask: "Listed by the Homebrew cask"+ case .managedByTheApp: "Managed by the app"}}}@@ -283,6 +284,8 @@ extension HoldBack {"Not selected: this holds VPN connections, with their keys and certificates, that may exist only on this Mac. Once the Trash is emptied, they’re gone for good unless you have a backup."case .holdsWorkMadeWithTheApp:"Not selected: this holds what you made with the app, such as saved games, databases, or the app’s own backups, which may exist only on this Mac. Once the Trash is emptied, it’s gone for good unless you have another copy."+ case .holdsSimulators:+ "Not selected: this holds the app’s simulators, with the apps installed in them and their data, which may exist only on this Mac. Once the Trash is emptied, they’re gone for good unless you have a backup."case .holdsKeys:"Left alone: a wallet or a key Peel protects is inside, so Peel leaves this folder where it is."case .holdsWorkKeptInACache:diff --git a/Peel/Views/Space/SpaceDetailView.swift b/Peel/Views/Space/SpaceDetailView.swiftindex 93911e79..278d6929 100644--- a/Peel/Views/Space/SpaceDetailView.swift+++ b/Peel/Views/Space/SpaceDetailView.swift@@ -32,9 +32,9 @@ struct SpaceDetailView: View {Section {Text(item.words.detail).font(.callout)- if item.words.hint != nil || !item.commands.isEmpty {+ if item.howToFreeIt != nil || !item.commands.isEmpty {LabeledContent {- if let hint = item.words.hint {+ if let hint = item.howToFreeIt {Text(hint).font(.callout).textSelection(.enabled)diff --git a/Peel/Views/Space/SpaceText.swift b/Peel/Views/Space/SpaceText.swiftindex 12a1df53..efb865aa 100644--- a/Peel/Views/Space/SpaceText.swift+++ b/Peel/Views/Space/SpaceText.swift@@ -11,6 +11,8 @@ nonisolated extension SpaceItem {let title: LocalizedStringResourcelet detail: LocalizedStringResourcevar hint: LocalizedStringResource?+ /// The hint while the apps that manage the area are gone from this Mac.+ var hintWithoutItsApp: LocalizedStringResource?}/// The words shown for this area. An area with no words here stops a Debug build, and a Release build@@ -28,12 +30,20 @@ nonisolated extension SpaceItem {words[id]}+ var howToFreeIt: LocalizedStringResource? {+ managingAppIsMissing ? words.hintWithoutItsApp ?? words.hint : words.hint+ }+private static let words: [String: Words] = ["simulators": Words(title: "Simulators",detail: "Devices and runtimes Xcode keeps for testing.",hint: LocalizedStringResource("Xcode > Settings > Components", comment: "Xcode's own menus, which are English in every language."+ ),+ hintWithoutItsApp: LocalizedStringResource(+ "Install Xcode again, then Xcode > Settings > Components",+ comment: "Xcode > Settings > Components are Xcode's own menus, which are English in every language.")),"android-sdk": Words(@@ -189,6 +199,9 @@ extension SpaceItem {assert(!hint.key.isEmpty, "\(id) has an empty hint")}}+ for id in SpaceInventory.managedAreaIdentifiers {+ assert(words[id]?.hintWithoutItsApp != nil, "\(id) has no hint for when its app is gone")+ }}}#endifdiff --git a/SAFETY.md b/SAFETY.mdindex 37890f98..efad43af 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -300,7 +300,8 @@ Never selected for you, even when found:inside.- What an app keeps that may exist only on this Mac: local mail, message history, a password manager's backups and anauthenticator's codes, VPN connections, a game's saves and a database, each where the app's own documentation or- source says it keeps them, and anything named as an app's backups.+ source says it keeps them, and anything named as an app's backups. When you uninstall Xcode, the simulators it made in+ your home folder are listed too, with the apps installed in them and their data, and never selected.- A copy Mail keeps of an attachment you opened, which you may have changed.- A file in iCloud Drive, which the Trash would take from every device, and a file a program has open right now.- An installer package an app keeps in Application Support, which the app may still need, and an update whose app is