bloaty

bloaty

a size profiler for binaries

curl -fsSL https://unflab.app/get | sh -s -- bloaty

Installs to ~/.local/bin. Add --prefix /usr/local/bin to
put it somewhere else, or --uninstall to remove it.

Why it’s here

Escapes a dependency tree: Homebrew’s build pulls in libraries this tool never touches at run time.

Details

Original package bloaty
Version 1.1
Licence Apache-2.0
Upstream https://github.com/google/bloaty
Source bloaty-1.1.tar.bz2
Version check bloaty --version
Download unflab-bloaty-1.1-arm64-apple-darwin.tar.gz

Built from that exact tarball, with its SHA-256 pinned in the
recipe. The binary links against nothing outside /usr/lib
and /System/, checked in CI before release.


Bloaty McBloatface is a size profiler for binaries. It tells you what’s
actually taking up space in an executable — which sections, which symbols,
which source files, which compile units — and can diff two binaries to
show what grew.

bloaty ./my-binary
bloaty -d symbols ./my-binary            # break down by symbol
bloaty -d compileunits ./my-binary       # by source file
bloaty ./new -- ./old                    # what changed between builds

bloaty --help lists the data sources and options.

Install

./install.sh                      # into ~/.local/bin
./install.sh --prefix /usr/local/bin
./install.sh --uninstall

About this build

There’s a joke here worth spelling out. brew install bloaty pulls in
abseil, protobuf, capstone and re2 — two of the largest C++
dependency trees around — to install a tool whose entire purpose is
telling you why your binary is too big.

It doesn’t need any of them at run time. Upstream’s release tarball
vendors all four, so this package compiles them straight into a single
self-contained binary that links only what macOS already provides.

No man page: upstream doesn’t ship one, and bloaty --help is the
documentation.

Building it yourself needs CMake 3.x, not 4: the vendored capstone
asks for CMake policy CMP0048 OLD, which CMake 4 removed entirely.
That’s a consequence of v1.1 being from 2020 — the prebuilt package has
none of this problem.

Upstream

Note that v1.1 (2020) is the latest tagged release, though development
continues on the main branch.

Bloaty is Google’s work, principally Josh Haberman’s. unflab only
compiles and packages it.