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
Find macOS installers in every app folder and by their older name
Țugui Dragoșe70f7204543c
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 62abc900..03c56c4b 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -390,13 +390,14 @@ macOS asks the user to approve it once. It talks to the app over XPC.- **Installers and Backups.** `Installers.scan` looks in Downloads, Desktop, Documents, Public, and `/Users/Shared`,and in the folders directly inside them, for disk images, packages, archives that hold an app or an installer (a zipis looked into), downloads a browser never finished, and device firmware, then at the macOS installers there and in- `/Applications`, the updates Sparkle, Squirrel, and electron-updater keep until they install them, the packages apps- keep in Application Support, and, with Full Disk Access, the device backups, which it only lists. What is smaller- than `minimumSize` isn't listed, a backup whatever its size. What it suggests can be downloaded again: an installed- app's installer, one that says where it was downloaded from (`DownloadOrigins`), a macOS installer, firmware, a- browser's unfinished download a day after its last change, and an update whose app is closed. The rest is held back,- such as an installer that arrived in the last hour, what changed in the last day, what a program has open or is- mounted, what syncs to other devices, and what is in `/Users/Shared`.+ the folders Peel reads apps from (`AppCatalog.directories`), the updates Sparkle, Squirrel, and electron-updater+ keep until they install them, the packages apps keep in Application Support, and, with Full Disk Access, the device+ backups, which it only lists. What is smaller than `minimumSize` isn't listed, a backup whatever its size. What it+ suggests can be downloaded again: an installed app's installer, one that says where it was downloaded from+ (`DownloadOrigins`), a macOS installer, firmware, a browser's unfinished download a day after its last change, and+ an update whose app is closed. The rest is held back, such as an installer that arrived in the last hour, what+ changed in the last day, what a program has open or is mounted, what syncs to other devices, and what is in+ `/Users/Shared`.- **Developer.** `DeveloperCaches.definitions` names each tool's folders, under the home folder, the account's cachefolder, or its temporary folder, each with what it holds (`ContentKind`) and where the tool documents it, a page ora file in its repository at a commit, which the tests hold. Only what one tool owns outright is listed: no toolchaindiff --git a/GUIDE.md b/GUIDE.mdindex 1140ba31..947b52c3 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -123,17 +123,18 @@ Space shows what fills your disk, area by area, and what each area is.and with the result.- **Installers and Backups:** disk images and packages in Downloads, Desktop, Documents, Public, and Shared, and inthe folders directly inside them, where installers are usually left, with archives there that hold an app or an- installer. It also lists packages an app keeps in Application Support, macOS installers, device firmware, downloads- never finished, and updates apps downloaded and keep until they install them. Your iPhone and iPad backups are- listed with their size once Peel has Full Disk Access, and never moved. Nothing is selected for you, and Select- Recommended takes only what you can download again, such as an installed app's installer, one that says where it was- downloaded from, a macOS installer, device firmware, a download a browser never finished once it hasn't changed for- a day, or an update whose app is closed. It passes by an encrypted disk image, an installer that is no installed- app's and doesn't say where it came from, one that arrived or changed in the last hour, a package an app keeps for- itself, a download that changed in the last day, a `.part` file no browser left, which a torrent client or another- program that resumes downloads may still finish, an update whose app is open, and anything in Shared, open in a- program, open as a disk image, or syncing to your other devices. A disk image can also be one you made to keep files- in, so look before you select it. An installer, download, or update smaller than 20 MB isn't listed.+ installer. It also lists packages an app keeps in Application Support, macOS installers there and in the folders+ Peel reads apps from, device firmware, downloads never finished, and updates apps downloaded and keep until they+ install them. Your iPhone and iPad backups are listed with their size once Peel has Full Disk Access, and never+ moved. Nothing is selected for you, and Select Recommended takes only what you can download again, such as an+ installed app's installer, one that says where it was downloaded from, a macOS installer, device firmware, a+ download a browser never finished once it hasn't changed for a day, or an update whose app is closed. It passes by+ an encrypted disk image, an installer that is no installed app's and doesn't say where it came from, one that+ arrived or changed in the last hour, a package an app keeps for itself, a download that changed in the last day, a+ `.part` file no browser left, which a torrent client or another program that resumes downloads may still finish, an+ update whose app is open, and anything in Shared, open in a program, open as a disk image, or syncing to your other+ devices. A disk image can also be one you made to keep files in, so look before you select it. An installer,+ download, or update smaller than 20 MB isn't listed.- **iCloud Drive:** files already safe in iCloud that are also downloaded to this Mac, as Finder shows them: what is iniCloud Drive and each app's documents, never an app's own data. Downloads are listed in the folders Finder showsthem in, named as Finder names them, the biggest first, and a folder's checkbox selects every file in it; a filediff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swiftindex ba6bec2f..4ec3a2c8 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift@@ -204,9 +204,15 @@ public enum Installers {}guard !Task.isCancelled else { return InstallerScan(items: items, unreadableLocations: unreadable) }- let applications = root.appending(path: "Applications", directoryHint: .isDirectory)+ // The folders Peel reads apps from come first, and each folder is looked in once.+ let shared = root.appending(path: "Users/Shared", directoryHint: .isDirectory).path(percentEncoded: false)+ let appFolders = AppCatalog.directories(in: SearchEnvironment(homeDirectory: home, rootDirectory: root)).map {+ let path = $0.path(percentEncoded: false)+ return Folder(url: $0, isSharedWithEveryone: PathComponents.isPath(path, atOrInside: shared))+ }+ var lookedIn: Set<String> = []items += await macOSInstallers(- in: [Folder(url: applications, isSharedWithEveryone: false)] + folders,+ in: (appFolders + folders).filter { lookedIn.insert(PathPattern.comparablePath(of: $0.url)).inserted },exclusions: exclusions,minimumSize: minimumSize,measure: measure,@@ -457,8 +463,7 @@ public enum Installers {) async -> [InstallerItem] {var items: [InstallerItem] = []for folder in folders {- for url in files(in: folder.url)- where url.pathExtension.lowercased() == "app" && url.lastPathComponent.hasPrefix("Install macOS") {+ for url in files(in: folder.url) where url.pathExtension.lowercased() == "app" && isMacOSInstaller(url) {guard !Task.isCancelled else { return items }guard !exclusions.excludes(url), !exclusions.holds(url) else { continue }let (size, seen, _) = await measured(url, by: measure)@@ -485,6 +490,12 @@ public enum Installers {return items}+ /// Apple names each macOS installer `Install macOS <name>`, and those before macOS Sierra `Install OS X <name>`+ /// (support.apple.com/101578).+ private static func isMacOSInstaller(_ url: URL) -> Bool {+ ["Install macOS", "Install OS X"].contains { url.lastPathComponent.hasPrefix($0) }+ }+static func firmwareFiles(home: URL,exclusions: Exclusions,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swiftindex e18c5cc6..2168d572 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift@@ -678,6 +678,27 @@ struct InstallersTests {#expect(scan.items(in: .firmware).map(\.name) == ["iPhone17,1_26.1.ipsw"])}+ /// A macOS installer is found in every folder Peel reads apps from, and one from before macOS Sierra by the name+ /// Apple gave it then.+ @Test func findsMacOSInstallersWhereverThePersonKeepsApps() async throws {+ let directory = try TemporaryDirectory()+ let home = directory.url.appending(path: "home", directoryHint: .isDirectory)+ try directory.file("root/Applications/Install OS X El Capitan.app/Contents/MacOS/app", bytes: 400_000)+ try directory.file("home/Applications/Install macOS Sequoia.app/Contents/MacOS/app", bytes: 400_000)+ try directory.file("Apps/Install macOS Ventura.app/Contents/MacOS/app", bytes: 400_000)+ try directory.file("Apps/Install Tool.app/Contents/MacOS/app", bytes: 400_000)+ let chosen = home.appending(path: "Library/Application Support/Peel/app-folders.json")+ try #require(AppFolders(url: chosen).add([directory.url.appending(path: "Apps", directoryHint: .isDirectory)]))++ let scan = await Installers.scan(+ installedApps: [], home: home, root: directory.url.appending(path: "root", directoryHint: .isDirectory),+ minimumSize: 100_000+ )++ #expect(Set(scan.items(in: .macOSInstaller).map(\.name))+ == ["Install OS X El Capitan", "Install macOS Sequoia", "Install macOS Ventura"])+ }+/// A folder is measured by walking all of it. Only a name that ends like an installer can ever be kept, so/// the name is read first: a projects folder in Documents is never walked to find out it is not a disk image.@Test func measuresOnlyWhatIsNamedLikeAnInstaller() async throws {