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
Count a Syncthing in the home's bin folder as on this Mac
Țugui Dragoș4119f13b992e
diff --git a/Packages/PeelCore/Sources/PeelCore/Support/SyncedFolders.swift b/Packages/PeelCore/Sources/PeelCore/Support/SyncedFolders.swiftindex 8948e74f..f0175dbc 100644--- a/Packages/PeelCore/Sources/PeelCore/Support/SyncedFolders.swift+++ b/Packages/PeelCore/Sources/PeelCore/Support/SyncedFolders.swift@@ -85,13 +85,12 @@ public enum SyncApp: String, Sendable, Hashable, CaseIterable {isOnThisMac(bundleIdentifiers: app.bundleIdentifiers, program: app.program)}- /// Whether macOS knows a bundle of one of `bundleIdentifiers` outside a Trash, or `program` is in the folders- /// Homebrew (on Apple silicon and on Intel) and MacPorts link programs into, or runs. A list of processes that- /// can't be read says the program may run.+ /// Whether macOS knows a bundle of one of `bundleIdentifiers` outside a Trash, or `program` is in one of+ /// `programFolders`, or runs. A list of processes that can't be read says the program may run.static func isOnThisMac(bundleIdentifiers: [String],program: String?,- programFolders: [String] = ["/opt/homebrew/bin", "/usr/local/bin", "/opt/local/bin"]+ programFolders: [String] = programFolders()) -> Bool {if bundleIdentifiers.contains(where: { !AppInspector.applicationURLs(forBundleIdentifier: $0).isEmpty }) {return true@@ -103,6 +102,16 @@ public enum SyncApp: String, Sendable, Hashable, CaseIterable {return runs(program) ?? true}+ /// The folders Homebrew (on Apple silicon and on Intel) and MacPorts link programs into, and the home's `bin`,+ /// where Syncthing's guide for macOS without Homebrew puts its program (docs.syncthing.net, Starting Syncthing+ /// Automatically), with a launchd agent that starts it.+ static func programFolders(home: URL = .homeDirectory) -> [String] {+ [+ "/opt/homebrew/bin", "/usr/local/bin", "/opt/local/bin",+ home.appending(path: "bin").path(percentEncoded: false),+ ]+ }+/// Whether a process runs a program named `name`, or nil when the processes can't be listed.private static func runs(_ name: String) -> Bool? {var pids = [pid_t](repeating: 0, count: 8_192)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SyncedFoldersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SyncedFoldersTests.swiftindex 9f55b88d..1fd49fd1 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/SyncedFoldersTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/SyncedFoldersTests.swift@@ -114,6 +114,19 @@ struct SyncedFoldersTests {#expect(SyncApp.isOnThisMac(bundleIdentifiers: [], program: name, programFolders: [folder]))}+ @Test func findsSyncthingWhereItsGuideForMacOSPutsIt() throws {+ let home = try TemporaryDirectory()+ let name = "org-example-sync-\(UUID().uuidString)"+ let folders = SyncApp.programFolders(home: home.url)++ #expect(!SyncApp.isOnThisMac(bundleIdentifiers: [], program: name, programFolders: folders))+ let program = try home.file("bin/\(name)")+ try FileManager.default.setAttributes(+ [.posixPermissions: 0o755], ofItemAtPath: program.path(percentEncoded: false)+ )+ #expect(SyncApp.isOnThisMac(bundleIdentifiers: [], program: name, programFolders: folders))+ }+@Test func findsASyncAppByTheProgramThatRuns() throws {let directory = try TemporaryDirectory()let name = "org-example-sync-\(UUID().uuidString.prefix(8))"diff --git a/SAFETY.md b/SAFETY.mdindex 31299a80..3a30d585 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -85,12 +85,12 @@ Anything that syncs to your other devices stays too, wherever it is: what iCloudwhat is on your Desktop and in Documents when they are in iCloud Drive, and what is in a folder Syncthing, Resilio Sync,Synology Drive Client, MEGA, or Dropbox outside File Provider keeps in step, known by the entry each writes at thatfolder's root (`.stfolder`, `.sync/ID`, `.SynologyWorkingDirectory`, `.megaignore`, `.dropbox.cache`) while that app is-on this Mac: macOS knows it, or Syncthing's program is where Homebrew or MacPorts put it, or runs. Only the app keeps-the folder in step, and its entry stays behind when the app goes and comes along when a folder is copied, so an entry-whose app isn't here counts for nothing. The Trash would take it from your other devices too. Its row says so, File-Search doesn't list it and says how many such files it left out, and Duplicates lists such a copy marked Stays, never-selected and never moved. Where an app's entry is the reason, Peel names the app and the entry's path, in the app and-from `peel`.+on this Mac: macOS knows it, or Syncthing's program runs or is where Homebrew, MacPorts, or Syncthing's guide for macOS+puts it (`~/bin`). Only the app keeps the folder in step, and its entry stays behind when the app goes and comes along+when a folder is copied, so an entry whose app isn't here counts for nothing. The Trash would take it from your other+devices too. Its row says so, File Search doesn't list it and says how many such files it left out, and Duplicates lists+such a copy marked Stays, never selected and never moved. Where an app's entry is the reason, Peel names the app and the+entry's path, in the app and from `peel`.Also refused: work that an app keeps inside a *cache* folder and nowhere else. A JetBrains IDE and Android Studio keep ahistory of your changes in `LocalHistory`, beside their caches, which no repository may hold, Deno keeps `localStorage`