I'm not good at English, so please take this into account when reading.
Since homebrew's deep dependencies cannot be retrieved with a simple script, I created an analysis tool.
(Analyze formula.jws.json, cask.jws.json, INSTALL_RECEIPT.json)
The tool also reads runtime_dependencies, allowing for complete uninstallation,
It also checks for build_dependencies with the . option to check build_dependencies
Examine the formulas that all formulas depend on.
|-formula(B)
|
formula(A)-|-formela(C)
|
|-formula(D)
formula(A).deps = formula(B),formula(C),formula(D)
Examine all formulas that depend on that formula.
formula(X)-|
|
formula(Y)-|-formula(A)
|
formula(z)-|
formula(A).uses = formula(X),formula(Y),formula(Z)
Save to simple database.
The heart of this tool lies in the part that creates intermediate files.
Every time you start the tool, it updates the simple database in the background every hour.
retrieve all dependent formulas from the simple database,
Check whether the formula is dependent on other formulas than the one on which it is dependent,
Select only formulas that are dependent on dependent formulas.
Formulas that are multi-level dependent in the tree structure and are higher up are not selected.
Compare all formula dependencies and extract unnecessary formulas.
Linux has special dependencies and takes time.
Linux's efl dependencies are a tree structure of over 7 million lines.
This is one of the features of the tool, but the source of the dependency check is long, so I will paste a link to it.
command
bl -dd <formula> # dry-run
bl -ddd <formula> # [y/n]
For example, if you want to remove the efl dependency but leave the ffmpeg dependency
( . Option build included )
bl -ddd efl ffmpeg or bl -ddd efl . ffmpeg
Affiliation Producer
https://github.com/konnano/brew_list
brew autoremove
is what you're looking for: