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.

Dart, RubyGems, RuboCop, Hex, rebar3, Gleam, Cabal, Stack, opam, LuaRocks, renv, Clojure, and mise

Țugui Dragoș75d18ad1d4d7
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index 8536fe4e..38c4210a 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -351,6 +351,8 @@ public enum DeveloperCaches {
// Other languages
Definition(id: "dart", name: "Dart & Flutter", systemImage: "chevron.left.forwardslash.chevron.right", appBundleIdentifiers: [], folders: [
Folder(".pub-cache/hosted", .downloads, source: "https://github.com/dart-lang/site-www/blob/main/src/content/tools/pub/cmd/pub-get.md#L99-L100"),
+ Folder(".pub-cache/git", .downloads, source: "https://github.com/dart-lang/pub/blob/main/lib/src/system_cache.dart#L48"),
+ Folder(".dartServer/.analysis-driver", .cache, source: "https://github.com/dart-lang/sdk/blob/main/pkg/analysis_server/lib/src/analysis_server.dart#L737-L741"),
]),
Definition(id: "composer", name: "Composer", systemImage: "chevron.left.forwardslash.chevron.right", appBundleIdentifiers: [], folders: [
Folder("Library/Caches/composer", .downloads, source: "https://github.com/composer/composer/blob/main/doc/06-config.md#L1105-L1108"),
@@ -362,6 +364,7 @@ public enum DeveloperCaches {
Folder(".cache/gem/gems", .downloads, source: "https://github.com/ruby/rubygems/blob/master/lib/rubygems/defaults.rb#L151-L158"),
Folder(".cache/gem/specs", .cache, source: "https://github.com/ruby/rubygems/blob/master/lib/rubygems/defaults.rb#L26-L28"),
Folder(".bundle/cache", .downloads, source: "https://github.com/ruby/rubygems/blob/master/lib/bundler.rb#L284-L303"),
+ Folder(".local/share/gem/ruby/*/cache", .downloads, source: "https://github.com/ruby/rubygems/blob/master/lib/rubygems/defaults.rb#L103-L109"),
]),
Definition(id: "nuget", name: "NuGet", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder(".nuget/packages", .downloads, source: "https://github.com/NuGet/docs.microsoft.com-nuget/blob/main/docs/consume-packages/managing-the-global-packages-and-cache-folders.md#L17"),
@@ -377,6 +380,41 @@ public enum DeveloperCaches {
Definition(id: "nix", name: "Nix", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
Folder(".cache/nix", .cache, source: "https://github.com/NixOS/nix/blob/master/src/libutil/include/nix/util/users.hh#L28-L30"),
]),
+ Definition(id: "rubocop", name: "RuboCop", systemImage: "chevron.left.forwardslash.chevron.right", appBundleIdentifiers: [], folders: [
+ Folder(".cache/rubocop_cache", .cache, source: "https://github.com/rubocop/rubocop/blob/master/lib/rubocop/cache_config.rb#L23-L26"),
+ ]),
+ Definition(id: "hex", name: "Hex", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ Folder(".hex/packages", .downloads, source: "https://github.com/hexpm/hex/blob/main/lib/hex/scm.ex#L8"),
+ ]),
+ Definition(id: "rebar3", name: "rebar3", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ Folder(".cache/rebar3/hex", .downloads, source: "https://github.com/erlang/rebar3/blob/main/apps/rebar/src/rebar_packages.erl#L159-L160"),
+ ]),
+ Definition(id: "gleam", name: "Gleam", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ Folder("Library/Caches/gleam/hex/hexpm/packages", .downloads, source: "https://github.com/gleam-lang/gleam/blob/main/compiler-core/src/paths.rs#L171-L183"),
+ ]),
+ Definition(id: "cabal", name: "Cabal", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ Folder(".cache/cabal", .downloads, source: "https://github.com/haskell/cabal/blob/master/doc/config.rst#L112-L115"),
+ ]),
+ Definition(id: "stack", name: "Haskell Stack", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ Folder(".stack/pantry/hackage", .downloads, source: "https://github.com/commercialhaskell/stack/blob/master/doc/topics/stack_root.md#L228-L232"),
+ Folder(".stack/setup-exe-cache", .buildData, source: "https://github.com/commercialhaskell/stack/blob/master/doc/topics/stack_root.md#L279-L285"),
+ ]),
+ Definition(id: "opam", name: "opam", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ Folder(".opam/download-cache", .downloads, source: "https://github.com/ocaml/opam/blob/master/doc/pages/Manual.md#L41"),
+ ]),
+ Definition(id: "luarocks", name: "LuaRocks", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ Folder(".cache/luarocks", .downloads, source: "https://github.com/luarocks/luarocks/blob/main/src/luarocks/core/cfg.lua#L411-L412"),
+ ]),
+ Definition(id: "renv", name: "renv", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ // renv links each project's library into this cache, so it is never selected.
+ Folder("Library/Caches/org.R-project.R/R/renv/cache", .environments, source: "https://github.com/rstudio/renv/blob/main/vignettes/package-install.Rmd#L56"),
+ ]),
+ Definition(id: "clojure", name: "Clojure", systemImage: "chevron.left.forwardslash.chevron.right", appBundleIdentifiers: [], folders: [
+ Folder(".gitlibs", .downloads, source: "https://github.com/clojure/tools.gitlibs/blob/master/README.md#L44"),
+ ]),
+ Definition(id: "mise", name: "mise", systemImage: "shippingbox", appBundleIdentifiers: [], folders: [
+ Folder("Library/Caches/mise", .cache, source: "https://github.com/jdx/mise/blob/main/docs/directories.md#L34-L41"),
+ ]),
// Editors
// A JetBrains IDE keeps `LocalHistory` beside its caches: the edits it recorded while a project was
// open, which are in no repository and nowhere else. The cache folders are listed one by one, so
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index be8fd302..6e2162b3 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -125,7 +125,9 @@ struct DeveloperCachesTests {
".local", ".local/share", "go", ".vscode", ".ollama", ".lmstudio", ".cache/huggingface",
]
// The only top-level folders in the table, each owned outright by the one tool that made it.
- let ownedOutright: Set<String> = [".ccache", ".electron-gyp", ".node-gyp", ".virtualenvs", "nltk_data", "tensorflow_datasets"]
+ let ownedOutright: Set<String> = [
+ ".ccache", ".electron-gyp", ".gitlibs", ".node-gyp", ".virtualenvs", "nltk_data", "tensorflow_datasets",
+ ]
for definition in DeveloperCaches.definitions {
for path in definition.folders.map(\.path) {
#expect(!risky.contains(path), "\(definition.id) points at \(path)")
@@ -144,13 +146,13 @@ struct DeveloperCachesTests {
let forbidden = [
".rustup", ".pyenv", ".sdkman", ".rbenv", ".jenv", "nix/store", ".nix-profile", ".asdf", ".volta",
"conda/envs", "miniconda3/envs", "anaconda3/envs", ".local/pipx",
- "Library/Android/sdk", "flutter/bin",
+ "Library/Android/sdk", "flutter/bin", ".stack/programs",
".aws", ".ssh", ".gnupg", ".netrc", ".docker/config", ".kube/config", ".npmrc",
"qiskit-ibm.json", "qiskitrc", "dwave.conf", ".qcs", "xanadu-cloud", "pytket", ".qnx", "qbraidrc",
"credentials", "token",
]
- // Folders that hold an account or the user's own work beside something cache-like.
- // Only their subfolders may ever be listed.
+ // Folders that hold an account, the user's own work, or an installation beside something cache-like. Only
+ // what is inside them may ever be listed, never they or a folder around them.
let onlyInParts: Set<String> = [
".kube/cache", ".azure", ".config/gcloud", ".pulumi", ".qiskit", ".qbraid", ".expo", ".lmstudio",
"Library/Preferences/netlify", "Library/Application Support/com.vercel.cli",
@@ -159,6 +161,10 @@ struct DeveloperCachesTests {
"Library/Caches/Coursier", ".ccache",
// Corepack keeps the package manager versions a person chose in `lastKnownGood.json` beside its downloads.
".cache/node/corepack",
+ // Hex and Gleam keep a Hex account's key beside their packages; pub, RubyGems, rebar3, Stack, and opam
+ // what they installed; renv each project's library; the Dart analysis server each plug-in's state.
+ ".hex", "Library/Caches/gleam/hex/hexpm", ".pub-cache", ".local/share/gem", ".cache/rebar3", ".stack", ".opam",
+ "Library/Caches/org.R-project.R/R/renv", ".dartServer",
]
// CocoaPods' spec repositories hold the ones a person added, which can carry unpushed work: only the CDN copy
// of the public index, `trunk`, is a cache. nvm's folder is nvm and every Node it installed; only its download
@@ -169,7 +175,9 @@ struct DeveloperCachesTests {
for pattern in forbidden {
#expect(!path.lowercased().contains(pattern.lowercased()), "\(definition.id) lists \(path)")
}
- #expect(!onlyInParts.contains(path), "\(definition.id) lists the whole of \(path)")
+ for folder in onlyInParts {
+ #expect(!PathComponents.isPath(folder, atOrInside: path), "\(definition.id) lists the whole of \(folder)")
+ }
for (folder, part) in onlyThisPart where PathComponents.isPath(path, atOrInside: folder) {
#expect(path == part, "\(definition.id) lists \(path)")
}