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
Call no system image the installer of the app that keeps it
Țugui Dragoș5c635876f197
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swiftindex 436170f0..4f97fef4 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift@@ -685,8 +685,8 @@ public enum Installers {/// Installers and system images in `~/Library/Application Support`, up to three levels down, never inside a/// package, a virtual machine, or what macOS keeps there for its own services, the device backups and Contacts- /// among them, and the images Parallels Desktop and VMware Fusion keep for making virtual machines. Each is matched- /// by its name to an installed app, or else by the folder it sits in.+ /// among them, and the images Parallels Desktop and VMware Fusion keep for making virtual machines. A package or a+ /// disk image is matched by its name to an installed app, or else by the folder it sits in.static func installersKeptByApps(home: URL,installedApps: [InstalledApp],@@ -698,14 +698,12 @@ public enum Installers {) async -> [InstallerItem] {let support = home.appending(path: "Library/Application Support", directoryHint: .isDirectory)var items: [InstallerItem] = []- // Parallels Desktop's cask names its downloads folder, and Broadcom's guide VMware Fusion's folder of images.+ // Parallels Desktop's cask names its downloads folder, and Broadcom's guide VMware Fusion's folder of images:+ // what they keep there is for making machines, no app's installer.var folders: [(url: URL, depth: Int, owner: String?)] = [(support, 1, nil),- (home.appending(path: "Library/Parallels/Downloads", directoryHint: .isDirectory), 3, "Parallels Desktop"),- (- home.appending(path: "Virtual Machines.localized/VMWIsoImages", directoryHint: .isDirectory), 3,- "VMware Fusion"- ),+ (home.appending(path: "Library/Parallels/Downloads", directoryHint: .isDirectory), 3, nil),+ (home.appending(path: "Virtual Machines.localized/VMWIsoImages", directoryHint: .isDirectory), 3, nil),]let virtualBuddy = support.appending(path: "VirtualBuddy", directoryHint: .isDirectory)let virtualBuddysImages = PathPattern.comparablePath(of: virtualBuddy.appending(path: "_Downloads"))@@ -730,7 +728,10 @@ public enum Installers {let heldBack = heldBack(url, seen: seen, in: place, syncKeeper: syncKeeper, openFiles: openFiles)- let named = installedApp(for: url, in: installedApps) == nil ? owner : nil+ // The folder an app keeps names the app a package or a disk image there installs. A system image, an+ // `.iso` or an `.ipsw`, installs no app.+ let installsAnApp = kind != "iso" && !firmwareExtensions.contains(kind)+ let named = installsAnApp && installedApp(for: url, in: installedApps) == nil ? owner : nilguard firmwareExtensions.contains(kind) else {items.append(appInstaller(at: url, size: size, heldBack: heldBack ?? .keptByAnApp, installedApps: installedApps,@@ -742,7 +743,6 @@ public enum Installers {&& imagesInUse.map { !$0.contains(PathPattern.comparablePath(of: url)) } == trueitems.append(firmware(at: url, size: size, heldBack: heldBack ?? .keptByAnApp,- installedApp: installedApp(named: named ?? "", in: installedApps)?.name,notes: isUnused ? [.unusedByAnyVirtualMachine] : []))}@@ -782,7 +782,7 @@ public enum Installers {}static func firmware(- at url: URL, size: Int64?, heldBack: HoldBack?, installedApp: String? = nil, notes: [InstallerItem.Note] = []+ at url: URL, size: Int64?, heldBack: HoldBack?, notes: [InstallerItem.Note] = []) -> InstallerItem {InstallerItem(url: url,@@ -790,7 +790,7 @@ public enum Installers {name: url.lastPathComponent,size: size,date: creationDate(of: url),- installedApp: installedApp,+ installedApp: nil,isReadOnly: false,notes: notes,requiresPrivileges: FileAccess.requiresPrivilegesToRemove(url),diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swiftindex 55ae9ba8..f3695147 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift@@ -599,6 +599,32 @@ struct InstallersTests {#expect(items.values.allSatisfy { $0.heldBack == .keptByAnApp })}+ @Test func callsNoImageTheInstallerOfTheAppThatKeepsIt() async throws {+ let directory = try TemporaryDirectory()+ let library = "Library/Application Support/VirtualBuddy"+ let unused = try directory.file("\(library)/_Downloads/UniversalMac_27.2_26B118_Restore.ipsw", bytes: 400_000)+ let tools = try directory.file("Library/Application Support/Tidewater/Tools.iso", bytes: 400_000)+ let setup = try directory.file("Library/Application Support/Tidewater/Tidewater-2.0.dmg", bytes: 400_000)+ let parallels = try directory.file("Library/Parallels/Downloads/Windows 11.iso", bytes: 400_000)+ try directory.directory("Applications")+ let apps = ["VirtualBuddy", "Tidewater", "Parallels Desktop"].map { name in+ InstalledApp(url: directory.url.appending(path: "Applications/\(name).app"), bundleIdentifier: nil, name: name)+ }++ let scan = await Installers.scan(+ installedApps: apps, home: directory.url, root: directory.url, exclusions: .none, minimumSize: 100_000,+ measure: LeftoverScanner.walk, openFiles: OpenFiles(excluding: nil)+ )++ let items = Dictionary(uniqueKeysWithValues: scan.items.map { (PathPattern.comparablePath(of: $0.url), $0) })+ let path = { (url: URL) in PathPattern.comparablePath(of: url) }+ #expect(items[path(unused)]?.installedApp == nil)+ #expect(items[path(unused)]?.notes == [.unusedByAnyVirtualMachine])+ #expect(items[path(tools)]?.installedApp == nil)+ #expect(items[path(parallels)]?.installedApp == nil)+ #expect(items[path(setup)]?.installedApp == "Tidewater")+ }+@Test func callsNoImageUnusedWhileAMachinesRecordCannotBeRead() async throws {let directory = try TemporaryDirectory()let library = "Library/Application Support/VirtualBuddy"