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
Developer lists the graphics caches of Chrome, Chromium, and Brave
Țugui Dragoșcd25bfd3b4cd
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swiftindex 660dd8a1..545f3588 100644--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift@@ -680,8 +680,43 @@ public enum DeveloperCaches {Folder("Library/Application Support/Jan/data/mlx/models", .models, source: "https://jan.ai/docs/desktop/data-folder"),Folder("Library/Application Support/Jan/data/logs", .logs, source: "https://jan.ai/docs/desktop/data-folder"),]),+ // Chromium's docs/user_data_dir.md names each Chrome channel's and Chromium's folder, and Brave's own+ // importer names Brave's. Their disk caches are in `Library/Caches`, which Space empties.+ Definition(+ id: "chrome", name: "Google Chrome", systemImage: "globe",+ appBundleIdentifiers: ["com.google.Chrome", "com.google.Chrome.beta", "com.google.Chrome.dev",+ "com.google.Chrome.canary"],+ folders: ["Chrome", "Chrome Beta", "Chrome Dev", "Chrome Canary"].flatMap {+ chromiumCaches(in: "Library/Application Support/Google/\($0)")+ }+ ),+ Definition(+ id: "chromium", name: "Chromium", systemImage: "globe", appBundleIdentifiers: ["org.chromium.Chromium"],+ folders: chromiumCaches(in: "Library/Application Support/Chromium")+ ),+ Definition(+ id: "brave", name: "Brave", systemImage: "globe", appBundleIdentifiers: ["com.brave.Browser"],+ folders: chromiumCaches(in: "Library/Application Support/BraveSoftware/Brave-Browser")+ ),]+ /// The caches Chromium keeps in a browser's user data folder, beside its profiles and in each of them, named where+ /// Chromium names them. What a profile holds for the person, its site data included, is never among them.+ private static func chromiumCaches(in userData: String) -> [Folder] {+ let browser = "https://github.com/chromium/chromium/blob/main/chrome/browser/"+ let gpu = "https://github.com/chromium/chromium/blob/main/gpu/ipc/common/gpu_disk_cache_type.cc#L43-L50"+ return ["ShaderCache", "GrShaderCache", "GraphiteDawnCache", "GPUPersistentCache"].map {+ Folder("\(userData)/\($0)", .cache, source: browser + "chrome_content_browser_client.cc#L5154-L5178")+ } + [+ Folder(+ "\(userData)/component_crx_cache", .downloads,+ source: browser + "component_updater/chrome_component_updater_configurator.cc#L135-L138"+ ),+ ] + ["GPUCache", "DawnWebGPUCache", "DawnGraphiteCache"].map {+ Folder("\(userData)/*/\($0)", .cache, source: gpu)+ }+ }+@concurrentpublic static func scan(homeDirectory: URL = .homeDirectory, exclusions: Exclusions = .none) async -> [DeveloperEnvironment] {await scan(definitions, homeDirectory: homeDirectory, exclusions: exclusions)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swiftindex bfd3f544..7461acee 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift@@ -97,6 +97,31 @@ struct DeveloperCachesTests {#expect(xcode.locations.first { $0.kind == .buildData }?.isRecommended == true)}+ @Test func listsABrowsersCachesAndNothingOfWhatItKeepsForThePerson() async throws {+ let directory = try TemporaryDirectory()+ let chrome = "Library/Application Support/Google/Chrome"+ let caches = [+ "ShaderCache", "GrShaderCache", "component_crx_cache", "Default/GPUCache", "Profile 1/DawnWebGPUCache",+ ]+ for cache in caches {+ try directory.file("\(chrome)/\(cache)/data_0", bytes: 4_096)+ }+ let kept = [+ "Default/Local Storage/leveldb/000003.log", "Default/Service Worker/CacheStorage/index", "Default/History",+ ]+ for kept in kept + ["Local State"] {+ try directory.file("\(chrome)/\(kept)", bytes: 4_096)+ }++ let environments = await DeveloperCaches.scan(homeDirectory: directory.url)++ let folder = directory.url.appending(path: chrome).path(percentEncoded: false) + "/"+ let listed = try #require(environments.first { $0.id == "chrome" }).locations.map {+ $0.url.path(percentEncoded: false).replacingOccurrences(of: folder, with: "")+ }+ #expect(Set(listed) == Set(caches))+ }+/// A large `DerivedData`, or a Gradle cache on a cold disk, may not be measured in time. Such a folder is not/// read as empty: it is listed first, with no size, and never selected for the user.@Test func aFolderThatDidNotAnswerInTimeIsNotReadAsEmpty() async throws {diff --git a/README.md b/README.mdindex 2040244e..469e2a04 100644--- a/README.md+++ b/README.md@@ -103,9 +103,10 @@ Peel is free and open source, and it speaks English and 17 other languages.- **Orphaned Files:** files left behind by apps you already removed.- **Developer:** caches of Xcode, package managers, build systems, editors, cloud and virtual machine tools, game- engines, and AI models. Xcode's archives and the symbols it copied from your devices, model weights, installed- packages, and what a tool keeps for you to install again (Vagrant boxes, Asset Store packages) are listed but- never selected for you, and toolchains or anything holding an account are never listed.+ engines, AI models, and the graphics caches of Chrome, Chromium, and Brave (never what a browser keeps for you).+ Xcode's archives and the symbols it copied from your devices, model weights, installed packages, and what a tool+ keeps for you to install again (Vagrant boxes, Asset Store packages) are listed but never selected for you, and+ toolchains or anything holding an account are never listed.- **Build Artifacts:** what builds left in the folders you choose, like `node_modules`, `DerivedData`, and`target`. A project changed in the last 7 days is never selected for you, and neither is a Python environment,Terraform's `.terraform`, or a folder like `target` whose name says nothing on its own.