Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Say what forgetting a receipt costs while its app is still installed

Țugui Dragoș887a1b5b4ae8
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 1bba9bef..6d194ef5 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -157303,6 +157303,112 @@
}
}
},
+ "Still installed" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Stále nainstalováno"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Noch installiert"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sigue instalado"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Toujours installé"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ancora installato"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "インストールされたまま"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "아직 설치되어 있음"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nog geïnstalleerd"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nadal zainstalowane"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ainda instalado"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Încă instalat"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Все еще установлено"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Fortfarande installerat"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hâlâ yüklü"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Досі інстальовано"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "仍已安装"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "仍已安裝"
+ }
+ }
+ }
+ },
"Stop" : {
"localizations" : {
"cs" : {
@@ -169177,6 +169283,112 @@
}
}
},
+ "The receipt goes to the Trash. What the package installed stays and keeps working, but macOS, installers that check the receipt, and Peel stop knowing the package installed it, so Peel can no longer list what it put on this Mac." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Záznam o instalaci se přesune do koše. Co balíček nainstaloval, zůstane a bude dál fungovat, ale systém macOS, instalátory, které záznam kontrolují, a Peel už nebudou vědět, že to nainstaloval tento balíček, takže Peel už nebude moci zobrazit, co balíček do tohoto Macu umístil."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Die Quittung wird in den Papierkorb gelegt. Was das Paket installiert hat, bleibt und funktioniert weiter, aber macOS, Installer, die die Quittung prüfen, und Peel wissen dann nicht mehr, dass das Paket es installiert hat, daher kann Peel nicht mehr anzeigen, was das Paket auf diesem Mac abgelegt hat."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "El recibo va a la papelera. Lo que instaló el paquete se queda y sigue funcionando, pero macOS, los instaladores que comprueban el recibo y Peel dejan de saber que lo instaló el paquete, así que Peel ya no puede mostrar lo que puso en este Mac."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Le reçu est placé dans la corbeille. Ce que le paquet a installé reste en place et continue de fonctionner, mais macOS, les programmes d’installation qui vérifient le reçu et Peel ne savent plus que ce paquet l’a installé : Peel ne peut donc plus lister ce qu’il a placé sur ce Mac."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "La ricevuta va nel Cestino. Ciò che il pacchetto ha installato resta e continua a funzionare, ma macOS, gli installer che controllano la ricevuta e Peel non sapranno più che l’ha installato il pacchetto, quindi Peel non potrà più elencare ciò che ha messo su questo Mac."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "レシートはゴミ箱に入ります。パッケージがインストールしたものはそのまま残り、引き続き動作しますが、macOS、レシートを確認するインストーラ、およびPeelは、それがこのパッケージによってインストールされたことを認識できなくなります。そのため、PeelはこのパッケージがこのMacに置いたものを一覧に表示できなくなります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "수신 정보는 휴지통으로 이동합니다. 패키지가 설치한 항목은 그대로 남아 계속 작동하지만, macOS와 수신 정보를 확인하는 설치 프로그램, Peel은 더 이상 이 패키지가 해당 항목을 설치했다는 것을 알 수 없게 됩니다. 따라서 Peel은 이 패키지가 이 Mac에 설치한 항목을 더 이상 나열할 수 없습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Het installatiebewijs gaat naar de prullenmand. Wat het pakket heeft geïnstalleerd, blijft staan en blijft werken, maar macOS, installatieprogramma's die het installatiebewijs controleren, en Peel weten dan niet meer dat het pakket het heeft geïnstalleerd, dus Peel kan niet meer tonen wat het pakket op deze Mac heeft gezet."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Potwierdzenie trafi do Kosza. To, co zainstalował pakiet, pozostanie i nadal będzie działać, ale macOS, instalatory sprawdzające potwierdzenia i Peel przestaną wiedzieć, że zainstalował to ten pakiet, więc Peel nie będzie już mógł wyświetlić tego, co pakiet umieścił na tym Macu."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O recibo vai para o Lixo. O que o pacote instalou permanece e continua funcionando, mas o macOS, os instaladores que verificam o recibo e o Peel deixam de saber que o pacote instalou esses itens, então o Peel não pode mais listar o que ele colocou neste Mac."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Recipisa este mutată în Coș. Ce a instalat pachetul rămâne și funcționează în continuare, dar macOS, programele de instalare care verifică recipisa și Peel nu vor mai ști că pachetul l‑a instalat, așa că Peel nu va mai putea lista ce a pus acesta pe acest Mac."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Квитанция перемещается в Корзину. То, что установил пакет, остается на месте и продолжает работать, но macOS, установщики, которые проверяют квитанцию, и сам Peel перестают знать, что это установил пакет, поэтому Peel больше не сможет показать, что пакет поместил на этот Mac."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kvittot flyttas till papperskorgen. Det som paketet installerade finns kvar och fortsätter att fungera, men macOS, installerare som kontrollerar kvittot och Peel vet inte längre att paketet installerade det, så Peel kan inte längre lista det som paketet placerade på den här datorn."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Makbuz Çöp Sepeti’ne gider. Paketin yüklediği şeyler olduğu yerde kalır ve çalışmaya devam eder, ancak macOS, makbuzu denetleyen yükleyiciler ve Peel bunları o paketin yüklediğini artık bilmez; bu yüzden Peel, paketin bu Mac’e koyduklarını artık listeleyemez."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Квитанцію буде переміщено в Смітник. Те, що інсталював пакет, залишиться й працюватиме далі, але macOS, інсталятори, які перевіряють квитанцію, і Peel більше не знатимуть, що це інсталював цей пакет, тож Peel більше не зможе показати, що пакет записав на цей Mac."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "回执会移到废纸篓。该软件包安装的内容会保留并继续正常工作,但macOS、会检查回执的安装器以及Peel都将不再知道这些内容是由该软件包安装的,因此Peel将无法再列出它在这台Mac上放置的内容。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "收據會丟到「垃圾桶」。此套件安裝的內容會保留並繼續運作,但macOS、會檢查收據的安裝程式以及Peel都將不再知道這些內容是由此套件安裝的,因此Peel將無法再列出它在這部Mac上放置的內容。"
+ }
+ }
+ }
+ },
"The receipt isn’t where macOS keeps receipts." : {
"localizations" : {
"cs" : {
@@ -189456,6 +189668,112 @@
}
}
},
+ "What this package installed is still on this Mac: %@." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "To, co tento balíček nainstaloval, je stále v tomto Macu: %@."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Was dieses Paket installiert hat, ist noch auf diesem Mac: %@."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Lo que instaló este paquete sigue en este Mac: %@."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ce que ce paquet a installé se trouve toujours sur ce Mac : %@."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ciò che questo pacchetto ha installato è ancora su questo Mac: %@."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このパッケージがインストールしたものは、まだこのMacにあります: %@。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 패키지가 설치한 항목이 아직 이 Mac에 있습니다: %@."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Wat dit pakket heeft geïnstalleerd, staat nog op deze Mac: %@."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "To, co zainstalował ten pakiet, nadal jest na tym Macu: %@."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O que este pacote instalou ainda está neste Mac: %@."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ce a instalat acest pachet se află încă pe acest Mac: %@."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "То, что установил этот пакет, все еще находится на этом Mac: %@."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Det som det här paketet installerade finns fortfarande på den här datorn: %@."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Bu paketin yükledikleri hâlâ bu Mac’te: %@."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Те, що інсталював цей пакет, досі є на цьому Mac: %@."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此软件包安装的内容仍在这台Mac上:%@。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此套件安裝的內容仍在這部Mac上:%@。"
+ }
+ }
+ }
+ },
"What to Do About It" : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift
index 72f0a2b2..97bcc799 100644
--- a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipt.swift
@@ -48,6 +48,8 @@ public struct PackageReceipt: Sendable, Hashable, Identifiable {
/// True when the package's scripts put its files in place: it installed into a temporary folder, or listed
/// nothing. Its receipt then doesn't say where they are, so nothing is judged left or gone from it.
public var installedThroughItsScripts = false
+ /// The names of the apps the package put on this Mac that are still where it put them.
+ public var installedApps: [String] = []
public var id: String { identifier }
diff --git a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift
index d273df4a..dc0a322b 100644
--- a/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Packages/PackageReceipts.swift
@@ -331,7 +331,8 @@ public enum PackageReceipts {
// Judged from the disk: `items` leaves out what is excluded or protected, even while it is there.
nothingLeftOnDisk: listing != nil && !throughScripts && found.onDisk.isEmpty,
isFileListKnown: listing != nil,
- installedThroughItsScripts: throughScripts
+ installedThroughItsScripts: throughScripts,
+ installedApps: apps.map(\.name).sorted()
),
paths: files.map { path(of: $0, in: installLocation).path(percentEncoded: false) }
)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift
index 91108b57..eed9a94e 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/PackageReceiptsTests.swift
@@ -249,6 +249,36 @@ struct PackageReceiptsTests {
#expect(gone.nothingLeftOnDisk && !gone.installedThroughItsScripts)
}
+ @Test func aPackageWhoseAppIsStillThereNamesIt() async throws {
+ let directory = try TemporaryDirectory()
+ let volume = PathPattern.canonical(directory.url)
+ let info = try PropertyListSerialization.data(
+ fromPropertyList: ["CFBundleIdentifier": "org.example.mixer", "CFBundleName": "Mixer"], format: .xml, options: 0
+ )
+ try directory.file("Applications/Mixer.app/Contents/Info.plist", contents: info)
+ let pkgutil: PackageReceipts.Pkgutil = { arguments in
+ switch arguments.first {
+ case "--pkgs-plist":
+ return PkgutilAnswer.packages("org.example.gone.pkg", "org.example.mixer.pkg")
+ case "--pkg-info-plist":
+ let info = ["volume": volume.path(percentEncoded: false), "install-location": "Applications"]
+ let data = try? PropertyListSerialization.data(fromPropertyList: info, format: .xml, options: 0)
+ return data.flatMap { String(data: $0, encoding: .utf8) }
+ case "--files":
+ return arguments[1] == "org.example.mixer.pkg"
+ ? "Mixer.app\nMixer.app/Contents\nMixer.app/Contents/Info.plist" : "Gone.app"
+ default:
+ return nil
+ }
+ }
+ let environment = SearchEnvironment(homeDirectory: volume.appending(path: "home"), rootDirectory: volume)
+
+ let scan = await PackageReceipts.list(exclusions: .none, pkgutil: pkgutil, environment: environment)
+
+ #expect(scan.receipts.first { $0.identifier == "org.example.mixer.pkg" }?.installedApps == ["Mixer"])
+ #expect(scan.receipts.first { $0.identifier == "org.example.gone.pkg" }?.installedApps == [])
+ }
+
@Test func leavesAnAppToFinderWhenMacOSInstalledItsSystemExtension() async throws {
let directory = try TemporaryDirectory()
let volume = PathPattern.canonical(directory.url)
diff --git a/Peel/Views/Packages/ForgetReceiptDialog.swift b/Peel/Views/Packages/ForgetReceiptDialog.swift
index 4d4df56b..466aa3af 100644
--- a/Peel/Views/Packages/ForgetReceiptDialog.swift
+++ b/Peel/Views/Packages/ForgetReceiptDialog.swift
@@ -27,9 +27,19 @@ struct ForgetReceiptDialog: ViewModifier {
outcome.report(result)
}
}
- Button("Cancel", role: .cancel) {}
- } message: { _ in
- Text("The receipt goes to the Trash, so macOS no longer counts the package as installed. What it installed stays where it is.")
+ // While what the package installed is still here, Return keeps the receipt, so the message is read.
+ if receipt.installedApps.isEmpty {
+ Button("Cancel", role: .cancel) {}
+ } else {
+ Button("Cancel", role: .cancel) {}
+ .keyboardShortcut(.defaultAction)
+ }
+ } message: { receipt in
+ if receipt.installedApps.isEmpty {
+ Text("The receipt goes to the Trash, so macOS no longer counts the package as installed. What it installed stays where it is.")
+ } else {
+ Text("The receipt goes to the Trash. What the package installed stays and keeps working, but macOS, installers that check the receipt, and Peel stop knowing the package installed it, so Peel can no longer list what it put on this Mac.")
+ }
}
}
diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swift
index b4063d0b..ab75a592 100644
--- a/Peel/Views/Packages/PackageDetailView.swift
+++ b/Peel/Views/Packages/PackageDetailView.swift
@@ -155,6 +155,12 @@ struct PackageDetailView: View {
name: String(localized: "Receipt only"),
detail: Text("macOS still counts this package as installed, but nothing it put on disk is left.")
)
+ } else if !receipt.installedApps.isEmpty {
+ 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))).")
+ )
}
}
} trailing: {
diff --git a/Peel/Views/Packages/PackageList.swift b/Peel/Views/Packages/PackageList.swift
index 90e79e35..b505a24f 100644
--- a/Peel/Views/Packages/PackageList.swift
+++ b/Peel/Views/Packages/PackageList.swift
@@ -19,6 +19,8 @@ struct PackageList: View {
HStack(spacing: 6) {
if receipt.nothingLeftOnDisk {
Text("Receipt only")
+ } else if !receipt.installedApps.isEmpty {
+ Text("Still installed")
} else if receipt.holdsNothingToRemove {
Text("Nothing Peel moves")
}