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
Treat an app on Package Receipts as its own page does, and say what a page holds back
Țugui Dragoșf0aa12c1e56a
diff --git a/GUIDE.md b/GUIDE.mdindex 10ffd58f..9f0b35c4 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -267,7 +267,7 @@ and how many items the others hold.warns that apps using it may stop working, says that macOS loads a camera plug-in only once legacy video devicesupport has been restored in macOS Recovery, or says that nothing loads it anymore, as for a Quick Look generator, anold Internet plug-in such as Flash, or a contextual menu item.-- **Package Receipts:** what installer packages other than Apple's put on your Mac, item by item, to move to the Trash.+- **Package Receipts:** what installer packages other than Apple's put on your startup disk, item by item, to move to the Trash.Nothing is selected for you, and Select Recommended passes by a folder a package made that now holds what somethingelse put there. Forget Receipt moves the receipt itself to the Trash, through Peel's helper, so macOS no longer countsthe package as installed, and Forget All does so at once for every package listed under Receipt Only, which leftdiff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 2b37350f..4dd35b05 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -66519,6 +66519,112 @@}}},+ "Installed Packages" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nainstalované balíčky"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Installierte Pakete"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Paquetes instalados"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Paquets installés"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pacchetti installati"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "インストール済みパッケージ"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "설치된 패키지"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Geïnstalleerde pakketten"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Zainstalowane pakiety"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pacotes Instalados"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pachete instalate"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Установленные пакеты"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Installerade paket"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Yüklü Paketler"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Інстальовані пакети"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "已安装的软件包"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "已安裝的套件"+ }+ }+ }+ },"Installed by a Package" : {"localizations" : {"cs" : {@@ -106188,6 +106294,112 @@}}},+ "Not selected: another package installed on this Mac lists it too, so what that package installed may use it." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nevybráno: tuto položku uvádí i jiný balíček nainstalovaný v tomto Macu, takže ji může používat to, co nainstaloval."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nicht ausgewählt: Ein anderes auf diesem Mac installiertes Paket führt es ebenfalls auf, daher wird es möglicherweise von dem verwendet, was jenes Paket installiert hat."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sin seleccionar: otro paquete instalado en este Mac también lo incluye, así que puede que lo use lo que instaló ese paquete."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Non sélectionné : un autre paquet installé sur ce Mac le liste aussi, et ce que ce paquet a installé peut donc l’utiliser."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Non selezionato: anche un altro pacchetto installato su questo Mac lo elenca, quindi ciò che quel pacchetto ha installato potrebbe usarlo."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未選択: このMacにインストールされているほかのパッケージにもこの項目が含まれているため、そのパッケージでインストールされたものが使用している可能性があります。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "선택되지 않음: 이 Mac에 설치된 다른 패키지에도 이 항목이 나열되어 있으므로, 그 패키지가 설치한 항목이 이 항목을 사용할 수 있습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Niet geselecteerd: een ander pakket dat op deze Mac is geïnstalleerd, vermeldt het ook, dus wat dat pakket heeft geïnstalleerd, gebruikt het misschien."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nie zaznaczono: wymienia to również inny pakiet zainstalowany na tym Macu, więc może z tego korzystać to, co zainstalował tamten pakiet."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Não selecionado: outro pacote instalado neste Mac também o lista, então o que esse pacote instalou pode usá-lo."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Neselectat: un alt pachet instalat pe acest Mac îl listează și el, așa că ce a instalat acel pachet îl poate utiliza."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не выбрано: этот объект также указан в другом пакете, установленном на этом Mac, поэтому то, что установил тот пакет, может его использовать."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Inte markerad: ett annat paket som är installerat på den här datorn listar den också, så det som det paketet har installerat kan använda den."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Seçilmedi: bu Mac’te yüklü başka bir paket de onu listeliyor, bu yüzden o paketin yükledikleri onu kullanıyor olabilir."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не вибрано: цей елемент також є у списку іншого пакета, інстальованого на цьому Mac, тож те, що інсталював той пакет, може ним користуватися."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未选择:这台Mac上安装的另一个软件包也列出了它,因此该软件包安装的内容可能会使用它。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未選取:這部Mac上安裝的另一個套件也列出了它,因此該套件安裝的項目可能會使用它。"+ }+ }+ }+ },"Not selected: it also keeps the options this build was set up with, which nothing else in the project holds." : {"localizations" : {"cs" : {@@ -172126,108 +172338,108 @@}}},- "Software installed with an installer package, other than Apple’s, will appear here." : {+ "Software installed on the startup disk with an installer package, other than Apple’s, will appear here." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Zde se zobrazí software nainstalovaný pomocí instalačního balíčku, s výjimkou softwaru od společnosti Apple."+ "value" : "Zde se zobrazí software nainstalovaný na spouštěcí disk pomocí instalačního balíčku, s výjimkou softwaru od společnosti Apple."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Software, die mit einem Installationspaket installiert wurde, wird hier angezeigt, sofern sie nicht von Apple stammt."+ "value" : "Software, die mit einem Installationspaket auf dem Startvolume installiert wurde, wird hier angezeigt, sofern sie nicht von Apple stammt."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Aquí aparecerá el software instalado con un paquete del instalador, salvo el de Apple."+ "value" : "Aquí aparecerá el software instalado en el disco de arranque con un paquete del instalador, salvo el de Apple."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "Les logiciels installés avec un paquet d’installation, hors ceux d’Apple, apparaîtront ici."+ "value" : "Les logiciels installés sur le disque de démarrage avec un paquet d’installation, hors ceux d’Apple, apparaîtront ici."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Qui apparirà il software installato con un pacchetto di installazione, tranne quello di Apple."+ "value" : "Qui apparirà il software installato sul disco di avvio con un pacchetto di installazione, tranne quello di Apple."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "インストーラパッケージでインストールされたソフトウェア(Apple製を除く)がここに表示されます。"+ "value" : "起動ディスクにインストーラパッケージでインストールされたソフトウェア(Apple製を除く)がここに表示されます。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "Apple 소프트웨어를 제외하고, 설치 프로그램 패키지로 설치한 소프트웨어가 여기에 표시됩니다."+ "value" : "Apple 소프트웨어를 제외하고, 설치 프로그램 패키지로 시동 디스크에 설치한 소프트웨어가 여기에 표시됩니다."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Software die met een installatiepakket is geïnstalleerd, behalve die van Apple, verschijnt hier."+ "value" : "Software die met een installatiepakket op de opstartschijf is geïnstalleerd, behalve die van Apple, verschijnt hier."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Tutaj pojawi się oprogramowanie zainstalowane za pomocą pakietu instalacyjnego, z wyjątkiem oprogramowania Apple."+ "value" : "Tutaj pojawi się oprogramowanie zainstalowane na dysku startowym za pomocą pakietu instalacyjnego, z wyjątkiem oprogramowania Apple."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "O software instalado com um pacote do instalador, exceto o da Apple, aparecerá aqui."+ "value" : "O software instalado no disco de inicialização com um pacote do instalador, exceto o da Apple, aparecerá aqui."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Aici va apărea software‑ul instalat cu un pachet de instalare, cu excepția celui de la Apple."+ "value" : "Aici va apărea software‑ul instalat pe discul de inițializare cu un pachet de instalare, cu excepția celui de la Apple."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Здесь появится ПО, установленное из установочных пакетов, кроме ПО Apple."+ "value" : "Здесь появится ПО, установленное на загрузочный диск из установочных пакетов, кроме ПО Apple."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Programvara som har installerats med ett installationspaket, utom Apples, visas här."+ "value" : "Programvara som har installerats på startskivan med ett installationspaket, utom Apples, visas här."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Apple’ınkiler dışında, bir yükleyici paketiyle yüklenen yazılımlar burada görünür."+ "value" : "Apple’ınkiler dışında, başlangıç diskine bir yükleyici paketiyle yüklenen yazılımlar burada görünür."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Тут зʼявлятиметься ПЗ, інстальоване з пакета інсталятора, крім ПЗ від Apple."+ "value" : "Тут зʼявлятиметься ПЗ, інстальоване на стартовий диск з пакета інсталятора, крім ПЗ від Apple."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "通过安装器软件包安装的软件(Apple的除外)将在此处显示。"+ "value" : "通过安装器软件包安装在启动磁盘上的软件(Apple的除外)将在此处显示。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "透過安裝程式套件安裝的軟體(Apple的除外)會顯示在此處。"+ "value" : "透過安裝程式套件安裝在啟動磁碟上的軟體(Apple的除外)會顯示在此處。"}}}diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swiftindex 6d6f05f6..72155785 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift@@ -387,6 +387,7 @@ extension HoldBack {case .gitTrackingNotReadInTime: "reading which files Git tracks here took too long"case .keepsItsSetup: "keeps the options its build was set up with"case .sharedWithEveryone: "belongs to everyone on this Mac"+ case .listedByAnotherPackage: "another installed package lists it too"case .holdsWhatOthersPut: "holds files something besides this package put there"case .namedLikeTheApp: "claimed on the app's name alone"case .holdsAnExclusion: "holds something you excluded"diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swiftindex 2df5ae20..ca124c75 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift@@ -59,6 +59,8 @@ public enum HoldBack: String, Sendable, Hashable {/// A folder a package made, offered whole while it holds what something else put there: another package's/// files, or the person's own.case holdsWhatOthersPut+ /// Another installed package lists it too, so what that package put on this Mac may use it.+ case listedByAnotherPackage/// Claimed on nothing but the app's name (or an identifier that is only a word), in the home folder or at the/// top of a Library, where a name alone is only a guess.case namedLikeTheAppdiff --git a/Packages/PeelCore/Sources/PeelCore/Packages/InstallHistory.swift b/Packages/PeelCore/Sources/PeelCore/Packages/InstallHistory.swiftindex 43779516..97a9ba39 100644--- a/Packages/PeelCore/Sources/PeelCore/Packages/InstallHistory.swift+++ b/Packages/PeelCore/Sources/PeelCore/Packages/InstallHistory.swift@@ -2,22 +2,30 @@ import Foundation/// The names macOS gives the packages it installed, from the history System Information shows under Installations.enum InstallHistory {- /// The newest name for each package identifier in `Library/Receipts/InstallHistory.plist` on `volume`.- static func names(onVolume volume: URL) -> [String: String] {+ /// What an installer called itself, for each package it installed.+ struct Entry: Equatable {+ let name: String+ /// Nil where the history leaves it empty.+ let version: String?+ }++ /// The newest entry for each package identifier in `Library/Receipts/InstallHistory.plist` on `volume`.+ static func entries(onVolume volume: URL) -> [String: Entry] {let url = volume.appending(path: "Library/Receipts/InstallHistory.plist")guard let data = BoundedRead.data(at: url, maximum: 16 * 1_048_576),let entries = (try? PropertyListSerialization.propertyList(from: data, format: nil)) as? [[String: Any]]else { return [:] }- var newest: [String: (name: String, date: Date)] = [:]+ var newest: [String: (entry: Entry, date: Date)] = [:]for entry in entries {guard let name = entry["displayName"] as? String, !name.isEmpty,let identifiers = entry["packageIdentifiers"] as? [String]else { continue }let date = entry["date"] as? Date ?? .distantPast+ let version = (entry["displayVersion"] as? String).flatMap { $0.isEmpty ? nil : $0 }for identifier in identifiers where date >= newest[identifier]?.date ?? .distantPast {- newest[identifier] = (name, date)+ newest[identifier] = (Entry(name: name, version: version), date)}}- return newest.mapValues(\.name)+ return newest.mapValues(\.entry)}}diff --git a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swiftindex 90170122..ccb187e7 100644--- a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift+++ b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift@@ -43,7 +43,7 @@ public struct PackageReceipt: Sendable, Hashable, Identifiable {public let installDate: Date?/// The volume the package was installed to, which is where its receipt is kept.public let volume: URL- public let items: [Item]+ public var items: [Item]/// True when the file list is known and nothing on it is still on disk. This is judged from the disk, not/// from `items`, which leaves out what is excluded or protected even while it is still there.public var nothingLeftOnDisk = false@@ -58,9 +58,15 @@ public struct PackageReceipt: Sendable, Hashable, Identifiable {public var apps: [InstalledApp] = []/// The name macOS gave the package when it installed it, such as "AdGuard", if its install history keeps one.public var name: String?+ /// The version of what the installer installed, as its history says it, which is what a person knows it by:+ /// `version` is the package's own number.+ public var productVersion: String?public var id: String { identifier }+ /// The version to show: the product's when the history gives one.+ public var shownVersion: String? { productVersion ?? version }+public var installedApps: [String] { apps.map(\.name).sorted() }/// What forgetting the package's files could free now, as an orphan group counts it. Unknown when the file listdiff --git a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swiftindex 9360bd71..409a0dde 100644--- a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift+++ b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift@@ -117,18 +117,36 @@ public enum PackageReceipts {}return results}- let names = InstallHistory.names(onVolume: environment.rootDirectory)+ let history = InstallHistory.entries(onVolume: environment.rootDirectory)return PackageScan(- receipts: receipts+ receipts: heldBackWhereShared(receipts).map { receipt invar named = receipt- named.name = names[receipt.identifier]+ named.name = history[receipt.identifier]?.name+ named.productVersion = history[receipt.identifier]?.versionreturn named}.sorted { $0.identifier.localizedStandardCompare($1.identifier) == .orderedAscending })}+ /// `receipts` with each item two of them list held back in both: moved from one package's page, it would leave+ /// the other package without it.+ private static func heldBackWhereShared(_ receipts: [PackageReceipt]) -> [PackageReceipt] {+ var listings: [String: Int] = [:]+ for item in receipts.flatMap(\.items) {+ listings[PathPattern.comparablePath(of: item.url), default: 0] += 1+ }+ return receipts.map { receipt in+ var receipt = receipt+ for index in receipt.items.indices where receipt.items[index].heldBack == nil+ && listings[PathPattern.comparablePath(of: receipt.items[index].url), default: 0] > 1 {+ receipt.items[index].heldBack = .listedByAnotherPackage+ }+ return receipt+ }+ }+/// Returns the receipts of the packages that installed `url`, asking `pkgutil` about that one path instead/// of listing every package.@concurrentdiff --git a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swiftindex 073c6f02..b07170df 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift@@ -372,8 +372,9 @@ struct PackageReceiptsTests {contents: PropertyListSerialization.data(fromPropertyList: history, format: .xml, options: 0))- #expect(InstallHistory.names(onVolume: directory.url) == ["org.example.mixer.pkg": "Mixer"])- #expect(InstallHistory.names(onVolume: directory.url.appending(path: "nowhere")).isEmpty)+ let names = InstallHistory.entries(onVolume: directory.url).mapValues(\.name)+ #expect(names == ["org.example.mixer.pkg": "Mixer"])+ #expect(InstallHistory.entries(onVolume: directory.url.appending(path: "nowhere")).isEmpty)var receipt = PackageReceipt(identifier: "org.example.mixer.pkg", version: nil, installDate: nil, volume: directory.url,@@ -1079,4 +1080,59 @@ struct PackageReceiptsTests {== false)}++ @Test func anItemTwoPackagesListIsHeldBackInBoth() async throws {+ let directory = try TemporaryDirectory()+ let volume = directory.url.appending(path: "root", directoryHint: .isDirectory)+ try directory.file("root/Vendor Shared/shared.db", bytes: 16)+ try directory.file("root/Vendor Own/own.db", bytes: 16)+ let files = [+ "com.example.one": "Vendor Shared\nVendor Shared/shared.db\nVendor Own\nVendor Own/own.db\n",+ "com.example.two": "Vendor Shared\nVendor Shared/shared.db\n",+ ]+ let pkgutil: PackageReceipts.Pkgutil = { arguments in+ switch arguments.first {+ case "--pkgs-plist":+ return PkgutilAnswer.packages("com.example.one", "com.example.two")+ case "--pkg-info-plist":+ let info = ["volume": volume.path(percentEncoded: false), "install-location": "/"]+ let data = try? PropertyListSerialization.data(fromPropertyList: info, format: .xml, options: 0)+ return data.flatMap { String(data: $0, encoding: .utf8) }+ case "--files":+ return files[arguments[1]]+ default:+ return nil+ }+ }+ let environment = SearchEnvironment(homeDirectory: volume.appending(path: "home"), rootDirectory: volume)++ let scan = await PackageReceipts.list(exclusions: .none, pkgutil: pkgutil, environment: environment)++ let items = scan.receipts.flatMap(\.items)+ let shared = items.filter { $0.url.lastPathComponent == "Vendor Shared" }+ #expect(shared.count == 2)+ #expect(shared.allSatisfy { $0.heldBack == .listedByAnotherPackage })+ #expect(items.first { $0.url.lastPathComponent == "Vendor Own" }?.heldBack == nil)+ }++ @Test func readsTheProductVersionFromTheInstallHistory() throws {+ let directory = try TemporaryDirectory()+ let entries: [[String: Any]] = [+ ["displayName": "Older", "displayVersion": "1.0", "packageIdentifiers": ["org.example.a"],+ "date": Date(timeIntervalSince1970: 1)],+ ["displayName": "Tools", "displayVersion": "26.5", "packageIdentifiers": ["org.example.a"],+ "date": Date(timeIntervalSince1970: 2)],+ ["displayName": "Plain", "displayVersion": "", "packageIdentifiers": ["org.example.b"],+ "date": Date(timeIntervalSince1970: 2)],+ ]+ try directory.file(+ "Library/Receipts/InstallHistory.plist",+ contents: PropertyListSerialization.data(fromPropertyList: entries, format: .xml, options: 0)+ )++ let history = InstallHistory.entries(onVolume: directory.url)++ #expect(history["org.example.a"] == InstallHistory.Entry(name: "Tools", version: "26.5"))+ #expect(history["org.example.b"] == InstallHistory.Entry(name: "Plain", version: nil))+ }}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PageBindingTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PageBindingTests.swiftnew file mode 100644index 00000000..0abffcce--- /dev/null+++ b/Packages/PeelCore/Tests/PeelCoreTests/PageBindingTests.swift@@ -0,0 +1,20 @@+import Foundation+import Testing++struct PageBindingTests {+ private func source(_ path: String) throws -> String {+ try String(contentsOf: LineLengthTests.repository.appending(path: path), encoding: .utf8)+ }++ @Test func severalAppsScanAgainWhenWhatHomebrewKnowsArrives() throws {+ #expect(try source("Peel/Views/MultipleAppsView.swift").contains(".task(id: homebrew.evidenceRevision)"))+ }++ @Test func packageReceiptsLooksAgainWhenPeelComesForwardAndAfterHistory() throws {+ let list = try source("Peel/Views/Packages/PackageList.swift")++ #expect(list.contains("NSApplication.didBecomeActiveNotification"))+ #expect(list.contains(".onChange(of: history.revision)"))+ #expect(list.contains(".rescanAfterPutBack(.packages)"))+ }+}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SeveralAppsPageTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SeveralAppsPageTests.swiftdeleted file mode 100644index 3b6698b4..00000000--- a/Packages/PeelCore/Tests/PeelCoreTests/SeveralAppsPageTests.swift+++ /dev/null@@ -1,11 +0,0 @@-import Foundation-import Testing--struct SeveralAppsPageTests {- @Test func scansAgainWhenWhatHomebrewKnowsArrives() throws {- let view = LineLengthTests.repository.appending(path: "Peel/Views/MultipleAppsView.swift")- let source = try String(contentsOf: view, encoding: .utf8)-- #expect(source.contains(".task(id: homebrew.evidenceRevision)"))- }-}diff --git a/Peel/Model/PackageLibrary.swift b/Peel/Model/PackageLibrary.swiftindex ab68f0fa..b31aab9f 100644--- a/Peel/Model/PackageLibrary.swift+++ b/Peel/Model/PackageLibrary.swift@@ -69,10 +69,19 @@ final class PackageLibrary {await record(result)return result}+ // An app's tile would stay in the Dock with a question mark, and History puts it back with the app.+ let apps = Self.appsThatMoved(in: result)+ if !apps.isEmpty {+ _ = await DockTiles().takeOut(apps, foundAt: result.trashedAt)+ }await refresh()return result}+ static func appsThatMoved(in result: TrashResult) -> [URL] {+ result.trashed.map(\.originalURL).filter { $0.pathExtension.caseInsensitiveCompare("app") == .orderedSame }+ }+func forget(_ receipts: [PackageReceipt], recording record: (TrashResult) async -> Void) async -> TrashResult {isWorking = truedefer { isWorking = false }diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swiftindex a2c5d2b6..6fa9586d 100644--- a/Peel/Views/Packages/PackageDetailView.swift+++ b/Peel/Views/Packages/PackageDetailView.swift@@ -9,14 +9,50 @@ struct PackageDetailView: View {@State private var isConfirmingRemoval = false@State private var receiptToForget: PackageReceipt?@Environment(RemovalOutcome.self) private var outcome+ @Environment(AppLibrary.self) private var library+ @Environment(\.openSettings) private var openSettings+ @State private var quitting = QuitBeforeRemoving()let receipt: PackageReceipt+ /// What runs from the apps selected here, which is asked to quit first, as on an app's own page.+ private var runningProcesses: [NSRunningApplication] {+ receipt.apps.filter { app in selectedItems.contains { $0.url == app.url } }.flatMap { app in+ RunningCopies.belonging(to: app, among: RunningCopies.current, installedApps: library.apps)+ .compactMap { NSRunningApplication(processIdentifier: $0.identifier) }+ }+ }++ private func moveSelection() async {+ let result = await history.moving(tool: .packages, source: receipt.identifier) {+ await packages.removeSelectedItems { result in+ await history.record(+ result,+ tool: .packages,+ source: receipt.identifier,+ sizes: [URL: Int64](measured: receipt.items.map { ($0.url, $0.size) })+ )+ }+ }+ outcome.report(result)+ }+var body: some View {List {header.listRowSeparator(.hidden)RemovalsHeldBanner()+ if isForAnExcludedApp {+ Notice(+ title: Text("This app is excluded"),+ detail: Text("The app this package installed is excluded in Settings, so Peel leaves its receipt alone too."),+ kind: .note+ ) {+ Button("Open Peel Settings") { SettingsPane.exclusions.open(with: openSettings) }+ }+ .listRowSeparator(.hidden)+ }+// Forget Receipt always needs the helper, whatever the items need, unless the exclusions leave it alone.if !helper.canAct {if receipt.itemsWaitingForTheHelper > 0 {@@ -115,18 +151,8 @@ struct PackageDetailView: View {isPresented: $isConfirmingRemoval) {Button("Move to Trash") {- Task {- let result = await history.moving(tool: .packages, source: receipt.identifier) {- await packages.removeSelectedItems { result in- await history.record(- result,- tool: .packages,- source: receipt.identifier,- sizes: [URL: Int64](measured: receipt.items.map { ($0.url, $0.size) })- )- }- }- outcome.report(result)+ quitting.check(runningProcesses) {+ Task { await moveSelection() }}}Button("Cancel", role: .cancel) {}@@ -136,6 +162,12 @@ struct PackageDetailView: View {}}.forgetReceiptDialog(for: $receiptToForget, forget: packages.forget)+ .alert(Text("Quit \(quitting.names) before removing it."), isPresented: Bindable(quitting).isAsking) {+ Button("Quit \(quitting.names)") { quitting.quit() }+ Button("Cancel", role: .cancel) { quitting.giveUp() }+ }+ .forceQuitOffer(quitting)+ .onDisappear { quitting.giveUp() }}/// Read from the exclusions, not the scan, so it holds as soon as they change.@@ -184,7 +216,7 @@ struct PackageDetailView: View {if let name = receipt.name {Badge(title: Text(verbatim: name), systemImage: "tag")}- if let version = receipt.version {+ if let version = receipt.shownVersion {Badge(title: Text("Version \(version)"), systemImage: "number")}if let date = receipt.installDate {@@ -200,7 +232,7 @@ struct PackageDetailView: View {NoteBadge(title: Text("Still installed"), systemImage: "app.badge.checkmark",name: String(localized: "Still installed"),- detail: Text("What this package installed is still on this Mac: \(receipt.installedApps.formatted(.list(type: .and))).")+ detail: Text("What this package installed is still on this Mac: \(RemovalFailureAlert.listed(receipt.installedApps))."))}}diff --git a/Peel/Views/Packages/PackageList.swift b/Peel/Views/Packages/PackageList.swiftindex d8636c59..9faa3af2 100644--- a/Peel/Views/Packages/PackageList.swift+++ b/Peel/Views/Packages/PackageList.swift@@ -41,6 +41,10 @@ struct PackageList: View {}Section {ForEach(filtered.filter { !$0.nothingLeftOnDisk }) { row(for: $0) }+ } header: {+ if !receiptsOnly.isEmpty {+ Text("Installed Packages")+ }}}.accessibilityLabel(Text(Tool.packages.title))@@ -56,7 +60,7 @@ struct PackageList: View {ContentUnavailableView("No Package Receipts",systemImage: "shippingbox",- description: Text("Software installed with an installer package, other than Apple’s, will appear here.")+ description: Text("Software installed on the startup disk with an installer package, other than Apple’s, will appear here."))} else if filtered.isEmpty, !searchText.isEmpty {ContentUnavailableView.search(text: searchText)@@ -121,8 +125,8 @@ struct PackageList: View {} else if receipt.holdsNothingToRemove {Text("Nothing Peel moves")}- if let version = receipt.version {- Text(verbatim: version)+ if let version = receipt.shownVersion {+ Text("Version \(version)")}}.font(.caption)diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swiftindex 31ec4efb..b6e6cc3c 100644--- a/Peel/Views/Presentation.swift+++ b/Peel/Views/Presentation.swift@@ -343,6 +343,8 @@ extension HoldBack {"Not selected: it also keeps the options this build was set up with, which nothing else in the project holds."case .sharedWithEveryone:"Not selected: /Users/Shared belongs to every account on this Mac, so this may be another account’s."+ case .listedByAnotherPackage:+ "Not selected: another package installed on this Mac lists it too, so what that package installed may use it."case .holdsWhatOthersPut:"Not selected: the package made this folder, but something else put files in it, which may be another program’s or yours."case .namedLikeTheApp: