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
Uninstall Citrix Workspace the way Citrix documents it
Țugui Dragoșcfae3f787da4
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 148f0a7a..c1ed103d 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -105,8 +105,9 @@ Take the most common case, uninstalling an app. Every other page follows the sam- An item stays where it is while a program holds it (`OpenFiles`): a file one of the user's programs holdsopen, or the program any process runs from it. Inside an app, which is code and loses nothing when it moves,a file open only for reading holds nothing, and neither does the program running from an app that- uninstalls itself once it has moved (`UninstallsItself`, Mullvad VPN's daemon), whose uninstaller's files- are held back (`leftToItsUninstaller`) rather than moved first.+ uninstalls itself once it has moved (`UninstallsItself`: Mullvad VPN's daemon, and Citrix Workspace's agent,+ known by the `WatchPaths` of its job file), whose uninstaller's files are held back (`leftToItsUninstaller`)+ rather than moved first.- What Peel itself runs from never moves, nor anything holding it, such as the folder a copy built from sourceruns from: only Remove Peel moves Peel (`TrashFailure.Reason.peelRunsFromIt`).- An app carrying a system extension macOS installed is left to Finder (`RemovedElsewhere.byFinder`): onlydiff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 94e91b6e..05491efe 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -93444,6 +93444,112 @@}}},+ "Once %@ leaves the Applications folder, its own uninstaller opens and asks for an administrator’s password. If you continue there, it deletes the app, even from the Trash, and its system files, which History can’t bring back." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Jakmile aplikace %@ opustí složku Aplikace, otevře se její vlastní odinstalátor a požádá o heslo správce. Pokud v něm budete pokračovat, smaže aplikaci, a to i z koše, a také její systémové soubory, které Historie nemůže vrátit."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sobald %@ den Ordner „Programme“ verlässt, öffnet sich das eigene Deinstallationsprogramm der App und fragt nach dem Passwort eines Administrators. Wenn du dort fortfährst, löscht das Deinstallationsprogramm die App, selbst aus dem Papierkorb, und ihre Systemdateien, die sich über den Verlauf nicht zurückholen lassen."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cuando %@ salga de la carpeta Aplicaciones, su propio desinstalador se abrirá y pedirá una contraseña de administrador. Si continúas en él, borrará la app, incluso de la papelera, y sus archivos del sistema, que Historial no puede recuperar."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Une fois %@ sorti du dossier Applications, son propre programme de désinstallation s’ouvre et demande le mot de passe d’un administrateur. Si vous continuez dans ce programme, il supprime l’app, même de la corbeille, ainsi que ses fichiers système, que l’Historique ne peut pas rétablir."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Quando %@ esce dalla cartella Applicazioni, il suo stesso programma di disinstallazione si apre e chiede la password di un amministratore. Se continui lì, il programma elimina l’app, anche dal Cestino, e i suoi file di sistema, che la Cronologia non può ripristinare."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@が“アプリケーション”フォルダから移動されると、アプリ独自のアンインストーラが開き、管理者のパスワードの入力を求めます。アンインストーラで操作を続けると、アプリはゴミ箱に入っていても、システム内に置いたファイルとともに削除され、履歴から元に戻すことはできません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "‘%@’이(가) 응용 프로그램 폴더에서 옮겨지면 앱 자체의 제거 프로그램이 열리고 관리자 암호를 요청합니다. 이 제거 프로그램에서 계속하면 앱이 휴지통에 있더라도 앱과 앱의 시스템 파일이 삭제되며, 이는 기록에서 되살릴 수 없습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Zodra %@ de map 'Apps' verlaat, wordt het eigen de-installatieprogramma van de app geopend, dat om een beheerderswachtwoord vraagt. Als je daar doorgaat, verwijdert het de app definitief, zelfs uit de prullenmand, en ook de systeembestanden ervan, en Geschiedenis kan ze niet terugzetten."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Gdy aplikacja %@ opuści folder Aplikacje, jej własny dezinstalator otworzy się i poprosi o hasło administratora. Jeśli będziesz w nim kontynuować, usunie aplikację, nawet z Kosza, oraz jej pliki systemowe, których Historia nie może przywrócić."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Assim que %@ sair da pasta Aplicativos, o próprio desinstalador do app abre e pede a senha de um administrador. Se você continuar nele, ele apaga o app, mesmo do Lixo, e os arquivos do app no sistema, que o Histórico não pode trazer de volta."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "După ce %@ iese din dosarul Aplicații, programul propriu de dezinstalare al aplicației se deschide și cere parola unui administrator. Dacă continuați acolo, acesta șterge aplicația, chiar și din Coș, și fișierele ei de sistem, care nu pot fi readuse din Istoric."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Как только приложение «%@» покинет папку «Программы», его собственная программа удаления откроется и запросит пароль администратора. Если Вы продолжите в ней, она удалит приложение, даже из Корзины, и его системные файлы, которые История не сможет вернуть."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "När %@ lämnar mappen Appar öppnas appens egen avinstallerare och ber om en administratörs lösenord. Om du fortsätter där raderar avinstalleraren appen, även från papperskorgen, och appens systemfiler, och dem kan Historik inte få tillbaka."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@ uygulaması Uygulamalar klasöründen çıktığında, kendi yükleme kaldırıcısı açılır ve bir yönetici parolası ister. Orada devam ederseniz uygulamayı, Çöp Sepeti’nde olsa bile, sistem dosyalarıyla birlikte siler; Geçmiş bunları geri getiremez."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Щойно програма «%@» залишить папку «Програми», її власний деінсталятор відкриється й попросить пароль адміністратора. Якщо ви продовжите в ньому, він видалить програму, навіть зі Смітника, а також її системні файли, і Історія не зможе їх повернути."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "一旦“%@”离开“应用程序”文件夹,它自己的卸载器就会打开,并要求你输入管理员密码。如果你在卸载器中继续,它会删除该App(即使已在废纸篓中也不例外)及其系统文件,“历史记录”无法将其恢复。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "一旦「%@」離開「應用程式」檔案夾,它自己的解除安裝程式就會打開,並要求輸入管理者密碼。如果你在那裡繼續,它就會刪除該App(即使已在「垃圾桶」中)及其系統檔案,而「歷史記錄」無法將其恢復。"+ }+ }+ }+ },"Once the file is in the Trash, the item is stopped." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swiftindex 6db43f97..04d47eea 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/AppCommands.swift@@ -415,13 +415,23 @@ struct UninstallCommand: AsyncParsableCommand {}/// What the removal does that the Trash can't bring back, said before the question.- static func warnings(moving urls: Set<URL>, of app: InstalledApp, resettingPrivacy: Bool) -> [String] {+ static func warnings(+ moving urls: Set<URL>,+ of app: InstalledApp,+ resettingPrivacy: Bool,+ environment: SearchEnvironment = .current+ ) -> [String] {var warnings: [String] = []if resettingPrivacy {warnings.append("Peel resets \(app.name)'s privacy permissions just before it moves. The Trash can't bring them back.")}- for app in UninstallsItself.when(moving: urls, among: [app]) {- warnings.append("Once \(app.app.name) leaves the Applications folder, its own service uninstalls it: it logs this Mac out of the account and deletes its settings, which the Trash can't bring back. Write down the account number first, or run its own uninstaller instead: \(app.uninstaller)")+ for app in UninstallsItself.when(moving: urls, among: [app], environment: environment) {+ switch app.uninstaller {+ case .logsOut(let script):+ warnings.append("Once \(app.app.name) leaves the Applications folder, its own service uninstalls it: it logs this Mac out of the account and deletes its settings, which the Trash can't bring back. Write down the account number first, or run its own uninstaller instead: \(script)")+ case .deletesTheApp:+ warnings.append("Once \(app.app.name) leaves the Applications folder, its own uninstaller opens and asks for an administrator's password. If you continue there, it deletes the app, even from the Trash, and its system files, which the Trash can't bring back.")+ }}return warnings}diff --git a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swiftindex 6b3c6fa5..607f446d 100644--- a/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift+++ b/Packages/PeelCore/Sources/PeelCore/BackgroundItems/BackgroundItems.swift@@ -340,6 +340,7 @@ struct JobDefinition {let associated: [String]/// True when `LimitLoadToSessionType`, a string or an array (`man launchd.plist`), names only Background.let loadsOnlyInTheBackground: Bool+ let watchPaths: [String]init?(contentsOf url: URL) {guard@@ -364,5 +365,6 @@ struct JobDefinition {let sessions = plist["LimitLoadToSessionType"]let types = (sessions as? String).map { [$0] } ?? (sessions as? [Any])?.compactMap { $0 as? String } ?? []loadsOnlyInTheBackground = types == ["Background"]+ watchPaths = (plist["WatchPaths"] as? [Any])?.compactMap { $0 as? String } ?? []}}diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/UninstallsItself.swift b/Packages/PeelCore/Sources/PeelCore/Removal/UninstallsItself.swiftindex 7fc81c36..bfa5ba89 100644--- a/Packages/PeelCore/Sources/PeelCore/Removal/UninstallsItself.swift+++ b/Packages/PeelCore/Sources/PeelCore/Removal/UninstallsItself.swift@@ -1,10 +1,17 @@public import Foundationinternal import PeelPrivileged-/// An app whose own service uninstalls it once the app leaves its place, deleting what History can't put back.+/// An app whose own uninstaller runs once the app leaves its place, deleting what History can't put back.public struct UninstallsItself: Sendable, Hashable {+ public enum Uninstaller: Sendable, Hashable {+ /// Logs the Mac out of the account and deletes the settings; the script can be run instead.+ case logsOut(script: String)+ /// Asks for an administrator, then deletes the app, even from the Trash, and its system files.+ case deletesTheApp+ }+public let app: InstalledApp- public let uninstaller: String+ public let uninstaller: Uninstallerprivate let removed: Set<String>/// Mullvad VPN's daemon watches `/Applications/Mullvad VPN.app`, and when its own program goes it logs the Mac out@@ -30,22 +37,80 @@ public struct UninstallsItself: Sendable, Hashable {home: ["Library/Logs/Mullvad VPN", "Library/Application Support/Mullvad VPN"])+ /// Citrix's agent `com.citrix.UninstallMonitor` watches the app's place and, once the app is gone, opens the+ /// uninstaller that deletes the app and its system files (Citrix's "Uninstall Citrix Workspace app for Mac").+ private static let citrix = (+ identifier: "com.citrix.receiver.nomas",+ monitor: "Library/LaunchAgents/com.citrix.UninstallMonitor.plist"+ )++ private static let citrixRemoves = (+ root: [+ "Library/LaunchAgents/com.citrix.AuthManager_Mac.plist",+ "Library/LaunchAgents/com.citrix.ReceiverHelper.plist",+ "Library/LaunchAgents/com.citrix.ServiceRecords.plist",+ "Library/LaunchAgents/com.citrix.safariadapter.plist",+ "Library/LaunchAgents/com.citrix.UninstallMonitor.plist",+ "Library/LaunchAgents/com.citrix.devicetrust.launchagent.plist",+ "Library/LaunchDaemons/com.citrix.CtxWorkspaceHelperDaemon.plist",+ "Library/LaunchDaemons/com.citrix.ReceiverUninstallHelper.plist",+ "Library/LaunchDaemons/com.citrix.ctxusbd.plist",+ "Library/LaunchDaemons/com.citrix.ctxworkspaceupdater.plist",+ "Library/Citrix Workspace",+ "Library/Application Support/Citrix Receiver",+ "Library/Application Support/deviceTRUST",+ "Library/Logs/Citrix Workspace",+ "private/var/db/receipts/com.citrix.ICAClient.bom",+ "private/var/db/receipts/com.citrix.ICAClient.plist",+ ],+ home: [+ "Library/Logs/Citrix Workspace",+ "Library/Application Support/Citrix Workspace",+ "Library/HTTPStorages/com.citrix.receiver.nomas",+ "Library/Preferences/com.citrix.receiver.nomas.plist",+ ]+ )+public static func of(_ app: InstalledApp, environment: SearchEnvironment = .current) -> UninstallsItself? {- let root = environment.rootDirectory- let place = root.appending(path: mullvad.path)+ mullvad(app, environment: environment) ?? citrix(app, environment: environment)+ }++ private static func mullvad(_ app: InstalledApp, environment: SearchEnvironment) -> UninstallsItself? {+ let place = environment.rootDirectory.appending(path: mullvad.path)guardapp.bundleIdentifier == mullvad.identifier,PathPattern.comparablePath(of: app.url) == PathPattern.comparablePath(of: place)else { return nil }- let removed = mullvadRemoves.root.map { root.appending(path: $0) }- + mullvadRemoves.home.map { environment.homeDirectory.appending(path: $0) }+ let script = place.appending(path: "Contents/Resources/uninstall.sh").path(percentEncoded: false)return UninstallsItself(app: app,- uninstaller: place.appending(path: "Contents/Resources/uninstall.sh").path(percentEncoded: false),- removed: Set(removed.map(PathPattern.comparablePath))+ uninstaller: .logsOut(script: script),+ removed: paths(mullvadRemoves, in: environment))}+ private static func citrix(_ app: InstalledApp, environment: SearchEnvironment) -> UninstallsItself? {+ let place = PathPattern.comparablePath(of: app.url)+ guard+ app.bundleIdentifier == citrix.identifier,+ let monitor = JobDefinition(contentsOf: environment.rootDirectory.appending(path: citrix.monitor)),+ !monitor.isDisabled,+ monitor.watchPaths.contains(where: { PathPattern.comparablePath(of: URL(filePath: $0)) == place }),+ let program = monitor.program,+ FileManager.default.isExecutableFile(atPath: program)+ else { return nil }+ return UninstallsItself(app: app, uninstaller: .deletesTheApp, removed: paths(citrixRemoves, in: environment))+ }++ private static func paths(+ _ removes: (root: [String], home: [String]),+ in environment: SearchEnvironment+ ) -> Set<String> {+ let urls = removes.root.map { environment.rootDirectory.appending(path: $0) }+ + removes.home.map { environment.homeDirectory.appending(path: $0) }+ return Set(urls.map(PathPattern.comparablePath))+ }+func removes(_ url: URL) -> Bool {let path = PathPattern.comparablePath(of: url)return removed.contains { PathComponents.isPath(path, atOrInside: $0) }diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UninstallsItselfTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UninstallsItselfTests.swiftindex a2289002..3bf5a7ac 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/UninstallsItselfTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/UninstallsItselfTests.swift@@ -11,7 +11,7 @@ struct UninstallsItselfTests {@Test func mullvadUninstallsItselfOnceItLeavesTheApplicationsFolder() {#expect(UninstallsItself.when(moving: [mullvad.url], among: [mullvad]).map(\.app) == [mullvad])#expect(UninstallsItself.when(moving: [mullvad.url], among: [mullvad]).map(\.uninstaller) == [- "/Applications/Mullvad VPN.app/Contents/Resources/uninstall.sh",+ .logsOut(script: "/Applications/Mullvad VPN.app/Contents/Resources/uninstall.sh"),])}@@ -197,4 +197,151 @@ struct UninstallsItselfTests {#expect(PrivacyReset.goingNow([installed.app], with: try installed.service()) == [installed.app])}++ private struct Citrix: ~Copyable {+ let directory: TemporaryDirectory+ let app: InstalledApp+ let environment: SearchEnvironment++ init(watching watched: String? = nil, disabled: Bool = false, uninstallerInPlace: Bool = true) throws {+ let directory = try TemporaryDirectory()+ let bundle = try directory.directory("root/Applications/Citrix Workspace.app")+ let uninstaller = "root/Library/Citrix Workspace/Uninstaller/Uninstall Citrix Workspace.app/Contents/MacOS/Uninstall Citrix Workspace"+ if uninstallerInPlace {+ try directory.file(uninstaller)+ try directory.setPermissions(0o755, of: uninstaller)+ }+ try directory.file(+ "root/Library/LaunchAgents/com.citrix.UninstallMonitor.plist",+ contents: PropertyListSerialization.data(+ fromPropertyList: [+ "Label": "com.citrix.UninstallMonitor",+ "Disabled": disabled,+ "ProgramArguments": [+ directory.url.appending(path: uninstaller).path(percentEncoded: false),+ "--monitor",+ "Citrix Workspace",+ ],+ "RunAtLoad": false,+ "WatchPaths": [watched ?? bundle.path(percentEncoded: false)],+ ],+ format: .xml,+ options: 0+ )+ )+ self.app = InstalledApp(url: bundle, bundleIdentifier: "com.citrix.receiver.nomas", name: "Citrix Workspace")+ self.environment = SearchEnvironment(+ homeDirectory: directory.url.appending(path: "home", directoryHint: .isDirectory),+ rootDirectory: directory.url.appending(path: "root", directoryHint: .isDirectory)+ )+ self.directory = directory+ }++ func job(_ path: String, running program: String) throws -> URL {+ let job = [+ "Label": URL(filePath: path).deletingPathExtension().lastPathComponent,+ "Program": app.url.appending(path: program).path(percentEncoded: false),+ ]+ return try directory.file(+ path,+ contents: PropertyListSerialization.data(fromPropertyList: job, format: .xml, options: 0)+ )+ }+ }++ @Test func citrixUninstallsItselfThroughTheAgentThatWatchesItsPlace() throws {+ let citrix = try Citrix()++ #expect(UninstallsItself.of(citrix.app, environment: citrix.environment)?.uninstaller == .deletesTheApp)+ }++ @Test func citrixIsAnOrdinaryAppWhenNoAgentWouldOpenItsUninstaller() throws {+ let elsewhere = try Citrix(watching: "/Applications/Another.app")+ let disabled = try Citrix(disabled: true)+ let noUninstaller = try Citrix(uninstallerInPlace: false)+ let noAgent = try Citrix()+ try FileManager.default.removeItem(+ at: noAgent.environment.rootDirectory.appending(path: "Library/LaunchAgents/com.citrix.UninstallMonitor.plist")+ )++ #expect(UninstallsItself.of(elsewhere.app, environment: elsewhere.environment) == nil)+ #expect(UninstallsItself.of(disabled.app, environment: disabled.environment) == nil)+ #expect(UninstallsItself.of(noUninstaller.app, environment: noUninstaller.environment) == nil)+ #expect(UninstallsItself.of(noAgent.app, environment: noAgent.environment) == nil)+ }++ @Test func leavesToCitrixsUninstallerWhatItDeletesAndOffersTheRest() async throws {+ let citrix = try Citrix()+ let helpers = "Contents/CitrixWorkspaceApps"+ let deletedByIt = [+ try citrix.job(+ "root/Library/LaunchAgents/com.citrix.safariadapter.plist",+ running: "\(helpers)/SafariAdapter.app/Contents/MacOS/SafariAdapter"+ ),+ try citrix.job("root/Library/LaunchDaemons/com.citrix.ctxusbd.plist", running: "\(helpers)/ctxusbd"),+ citrix.environment.rootDirectory.appending(path: "Library/LaunchAgents/com.citrix.UninstallMonitor.plist"),+ citrix.environment.rootDirectory.appending(path: "Library/Citrix Workspace"),+ try citrix.directory.directory("root/Library/Logs/Citrix Workspace"),+ try citrix.directory.directory("home/Library/Logs/Citrix Workspace"),+ try citrix.directory.directory("home/Library/Application Support/Citrix Workspace"),+ try citrix.directory.directory("home/Library/HTTPStorages/com.citrix.receiver.nomas"),+ try citrix.directory.file("home/Library/Preferences/com.citrix.receiver.nomas.plist"),+ ]+ let leftByIt = [+ try citrix.job(+ "root/Library/LaunchAgents/com.citrix.PluginBroker.plist",+ running: "\(helpers)/Citrix Plugin Broker.app/Contents/MacOS/Citrix Plugin Broker"+ ),+ try citrix.directory.directory("home/Library/Caches/com.citrix.receiver.nomas"),+ try citrix.directory.directory("home/Library/WebKit/com.citrix.receiver.nomas"),+ ]++ let plan = await Uninstallation.prepare(+ citrix.app, installedApps: [citrix.app], environment: citrix.environment+ )++ let heldBack = Dictionary(+ plan.scan.leftovers.map { (PathPattern.comparablePath(of: $0.url), $0.match.heldBack) },+ uniquingKeysWith: { first, _ in first }+ )+ for url in deletedByIt {+ #expect(heldBack[PathPattern.comparablePath(of: url)] == .some(.leftToItsUninstaller), "\(url.path())")+ }+ for url in leftByIt {+ #expect(heldBack[PathPattern.comparablePath(of: url)] == .some(nil), "\(url.path())")+ }+ }++ @Test func citrixsBundleMovesWhileItsHelperRunsFromIt() async throws {+ let citrix = try Citrix()+ let helper = try citrix.directory.runningProgram(+ "root/Applications/Citrix Workspace.app/Contents/CitrixWorkspaceApps/CtxWorkspaceHelperDaemon.app/Contents/MacOS/CtxWorkspaceHelperDaemon"+ )+ defer { helper.terminate() }+ let trash = try citrix.directory.directory("home/.Trash")+ let service = TrashService(environment: citrix.environment) { url in+ let destination = trash.appending(path: url.lastPathComponent)+ try FileManager.default.moveItem(at: url, to: destination)+ return destination+ }+ let plan = await Uninstallation.prepare(+ citrix.app, installedApps: [citrix.app], environment: citrix.environment+ )++ let result = await plan.move([citrix.app.url], using: service)++ #expect(result.failures.isEmpty, "\(result.failures.map(\.reason))")+ #expect(result.trashed.map(\.originalURL) == [citrix.app.url])+ }++ @Test func peelUninstallWarnsThatCitrixsUninstallerDeletesTheApp() throws {+ let citrix = try Citrix()++ let warnings = UninstallCommand.warnings(+ moving: [citrix.app.url], of: citrix.app, resettingPrivacy: false, environment: citrix.environment+ )++ #expect(warnings.count == 1)+ #expect(warnings.first?.contains("deletes the app, even from the Trash") == true)+ }}diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swiftindex 08847d40..a2270c57 100644--- a/Peel/Views/Presentation.swift+++ b/Peel/Views/Presentation.swift@@ -117,7 +117,12 @@ extension SearchLocation.Kind {extension UninstallsItself {var warning: Text {- Text("Once \(app.name) leaves the Applications folder, its own service uninstalls it: it logs this Mac out of your account and deletes its settings, which History can’t bring back. Write down your account number first, or run the app’s own uninstaller instead: `\(uninstaller)`.")+ switch uninstaller {+ case .logsOut(let script):+ Text("Once \(app.name) leaves the Applications folder, its own service uninstalls it: it logs this Mac out of your account and deletes its settings, which History can’t bring back. Write down your account number first, or run the app’s own uninstaller instead: `\(script)`.")+ case .deletesTheApp:+ Text("Once \(app.name) leaves the Applications folder, its own uninstaller opens and asks for an administrator’s password. If you continue there, it deletes the app, even from the Trash, and its system files, which History can’t bring back.")+ }}}diff --git a/SAFETY.md b/SAFETY.mdindex 00a0cc8c..f7893fc5 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -144,7 +144,7 @@ process runs, and leaves where it is any file or folder with one of them inside,database or a cache from under an agent, a daemon, or a server that is using it would break it. An app is code,which loses nothing when it moves, so a program that only reads inside it, as Safari reads an app's Safariextension, does not keep it in place; one that runs from it or writes in it does, unless the app uninstalls itself-once it is moved, as Mullvad VPN does: the program running from it is the one that cleans up. Peel itself counts+once it is moved, as Mullvad VPN and Citrix Workspace do: their own uninstaller stops it. Peel itself countstoo: whatever Peel runs from, and any folder holding it, stays, since only Remove Peel moves Peel. Of programs thatrun as another account or as root, macOS's own among them, only the program can be seen, never the files it holdsopen, which is why Space also leaves macOS's own caches unselected, and in the Library at the top of the disk, where@@ -174,11 +174,14 @@ Four things Peel starts can't be undone by History, and Peel says so before youForgetting a preference domain after a removal is not one of them: it happens only once the file is in the Trash,and putting the file back undoes it, until the app writes its settings again.-One app deletes something of its own once it is moved: Mullvad VPN's service logs the Mac out of its account and-deletes its settings when the app leaves the Applications folder, which Peel says before it moves it. What that-service removes (its launch daemon's file, its command links and shell completions, its receipt, its logs, and its-settings) is listed and never moved by Peel: moving the daemon's file first would stop the service before it could-clean up.+Two apps delete something of their own once they are moved, which Peel says before it moves them. Mullvad VPN's+service logs the Mac out of its account and deletes its settings when the app leaves the Applications folder; what+that service removes (its launch daemon's file, its command links and shell completions, its receipt, its logs, and+its settings) is listed and never moved by Peel: moving the daemon's file first would stop the service before it+could clean up. Citrix Workspace's own agent opens Citrix's uninstaller once the app is gone from the Applications+folder, which asks for an administrator's password and, if you continue, deletes the app, even from the Trash, and+its system files; what it deletes (its launch agents and daemons, its folders in the Library, its logs, its receipt,+and its settings) is listed and never moved by Peel, since moving the agent's file would stop the uninstaller.If the record itself is damaged, it is set aside under another name rather than overwritten, because it isthe only way back from a removal. If it can't be read at all, Peel moves nothing until it can, or until you