Why
Homebrew flattens every dependency into a single Cellar directory. Tools like du or ncdu can tell you a formula takes up 500 MB, but they have no concept of why — whether that mass belongs to the formula itself or to a shared runtime pulled in by five other packages you installed for unrelated reasons.
Dark Matter reconstructs the dependency graph Homebrew already knows about and uses it to answer a more useful question: for each package you explicitly installed, how much disk space does it actually cost you, once shared dependencies are fairly split across everything that depends on them?
How it works
Dark Matter parses Homebrew's own JSON metadata (via brew info --json=v2 or its local API cache), rebuilds the dependency DAG, and walks it to compute two figures per package:
- Core size — the package's own on-disk footprint (or, in theoretical mode, its compressed bottle archive).
- Weighted recursive size — the core size plus a fair share of every transitive dependency, where each shared dependency's cost is divided evenly across all the packages that depend on it.
The ratio between the two — the Bloat Ratio — is the headline number. A low ratio means a package is mostly self-contained; a high ratio means most of its footprint belongs to shared infrastructure it happens to require.
Features
- Comprehensive analysis suite
analyze— measures what's actually on disk, usingbrew info --json=v2 --installedand direct filesystem traversal (os.scandir) for exact byte counts.leaderboard— a theoretical mode that ranks Homebrew's entire formula and cask catalog from the local API cache, without requiring anything to be installed.inspect&compare— targeted O(1) theoretical resolution for individual or grouped packages without resolving the entire ecosystem payload.explain— breaks down a target package's bloat by attributing fractional byte costs to each of its transitive dependencies.export— streams the underlying DataFrames to CSV or JSON for integration into external data pipelines.
- Fractional Attribution Model — shared dependencies (
openssl,python, etc.) are divided proportionally across all parent packages instead of being double-counted, giving an honest per-package cost. - Daemon-free — no background indexing, no persistent database. Every run is a fresh, on-demand computation.
- Typed and tested — fully type-annotated (strict
mypy), linted withruff, and covered by apytestsuite exercising the DAG traversal, fractional math, and network resolution logic. CI runs the full suite on macOS and Ubuntu across Python 3.12 and 3.14.
A note on theoretical measurements
leaderboard, inspect, compare, and explain rely on Content-Length headers from ghcr.io blob storage, which report compressed archive size, not the size a package occupies once unpacked to disk. The absolute numbers they report will therefore run lower than analyze's physical measurements.
The Bloat Ratio, however, stays meaningful. Since most bottles compress with similar algorithms (gzip or zstd), the compression factor $c$ appears in both the numerator and denominator and cancels out:
$$R \approx \frac{c \cdot m_{recursive}}{c \cdot m_{core}} \approx \frac{m_{recursive}}{m_{core}}$$
So while theoretical modes shouldn't be read as precise disk-space forecasts, they are a reliable way to evaluate relative bloat without installing anything.
Installation
git clone https://github.com/jacksonfergusondev/dark-matter.git
cd dark-matter
uv tool install --editable .
Usage
# Analyze what's actually installed
dark-matter analyze
# Rank the entire Homebrew catalog by theoretical bloat
dark-matter leaderboard
# Evaluate a specific formula instantly
dark-matter inspect uv
# Break down the dependency bloat of a specific package
dark-matter explain uv
# Compare multiple packages side-by-side
dark-matter compare uv poetry pdm
# Export the entire graph to JSON for external analysis
dark-matter export --format json > homebrew_bloat.json
All commands accept the global --verbose / -v flag for debug logging, and --version to print the installed version.
analyze
| Flag | Default | Description |
|---|---|---|
--sort / -s |
ratio |
Sort by ratio, core, or recursive |
--top / -n |
20 |
Number of packages to display |
--fractional / --standard |
--fractional |
Toggle the Fractional Attribution Model |
leaderboard
| Flag | Default | Description |
|---|---|---|
--sort / -s |
ratio |
Sort by ratio, core, or recursive |
--top / -n |
20 |
Number of packages to display |
--arch / -a |
arm64_tahoe |
Target bottle architecture |
inspect
| Argument/Flag | Default | Description |
|---|---|---|
[PACKAGE] |
Required | The target package to analyze |
--source / -s |
installed |
Data source to compute: installed or catalog |
--arch / -a |
arm64_tahoe |
Target bottle architecture |
compare
| Argument/Flag | Default | Description |
|---|---|---|
[PACKAGES]... |
Required | A space-separated list of packages to compare |
--sort / -s |
ratio |
Sort by ratio, core, or recursive |
--source / -s |
installed |
Data source to compute: installed or catalog |
--arch / -a |
arm64_tahoe |
Target bottle architecture |
explain
| Argument/Flag | Default | Description |
|---|---|---|
[PACKAGE] |
Required | The specific package to analyze |
--source / -s |
installed |
Data source to compute: installed or catalog |
--arch / -a |
arm64_tahoe |
Target bottle architecture |
export
| Flag | Default | Description |
|---|---|---|
--source / -s |
installed |
Data source to compute: installed or catalog |
--format / -f |
csv |
Output format: csv or json |
--arch / -a |
arm64_tahoe |
Target bottle architecture (for catalog source) |
Development
The project uses just to wrap common tasks:
just format # ruff format + fix
just lint # ruff + rumdl
just typecheck # mypy
just test # pytest
just test-cov # pytest with coverage report
just ci # the full pipeline CI runs, locally
📧 Contact
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for dark-matter-cli 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dark_matter_cli-0.1.4.tar.gz | 85.5 kB | With provenance | Details for dark_matter_cli-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dark_matter_cli-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for dark_matter_cli-0.1.4-py3-none-any.whl |
Total release size: 102.8 kB
Release files / dark_matter_cli-0.1.4.tar.gz
| Download URL | dark_matter_cli-0.1.4.tar.gz |
|---|---|
| Size | 85.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ed0ff1f6896c4da5ca565a1ff196ed3a8699f713875e953d9be26fd2f95c6d2
|
|
BLAKE2b-256 checksum How to use checksums |
0487956814472803ddde93f5b8eb59025729967d3e31a220c4bf5cc66734d2d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / dark_matter_cli-0.1.4-py3-none-any.whl
| Download URL | dark_matter_cli-0.1.4-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ae206a2a0452a49ef74574c199b2905e2ecf7760807a09fe2f08f2031b0b2e08
|
|
BLAKE2b-256 checksum How to use checksums |
064b0279f1fa10665429887a12e8ad75ea6471aabf49ad91c20cd51b2c927a49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logSecurity for dark-matter-cli 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for dark_matter_cli-0.1.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.