Skip to content

Show a build progress spinner - #24261

Closed
HaraldNordgren wants to merge 1 commit into
Homebrew:mainfrom
HaraldNordgren:build-progress
Closed

HaraldNordgren wants to merge 1 commit into
Homebrew:mainfrom
HaraldNordgren:build-progress

Conversation

@HaraldNordgren

@HaraldNordgren HaraldNordgren commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Without --verbose, build commands only write to their logs, so brew shows nothing while they run. A long build such as llvm prints ==> cmake --build build and then nothing for a long time, so it looks stuck. Unpacking a large source tarball and configure steps can be silent for a while too. The only way to tell it is still working is to find and tail the logs in ~/Library/Logs/Homebrew/<formula>.

This keeps a spinner below the build output for the whole build, so it never looks stuck. During a step without progress markers, e.g. CMake's configure step:

==> Upgrading ccache dependency: llvm (22.1.8 -> 23.1.3_1)
==> Patching
==> Applying llvm/pull-111397.diff
patching file clang/lib/Driver/Driver.cpp
Hunk #1 succeeded at 1461 (offset -30 lines).
Hunk #2 succeeded at 1508 (offset -30 lines).
Hunk #3 succeeded at 1568 (offset -30 lines).
patching file clang/test/Driver/Inputs/config-cl/config-arm64ec-arg.cfg
patching file clang/test/Driver/config-file.c
==> cmake -S /private/tmp/s-E9aY5M2F/llvm-20261014-36487-a8o0ru/llvm-project-23.1.3.src/llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;mlir;polly -DLLVM_ENABLE_RUNT
⠦

And when the current command prints Ninja ([12/345]) or CMake ([ 42%]) progress markers:

==> cmake -S /private/tmp/s-E9aY5M2F/llvm-20261014-36487-a8o0ru/llvm-project-23.1.3.src/llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS=clang;clang-tools-extra;mlir;polly -DLLVM_ENABLE_RUNT
==> cmake --build build
⠓ 63/9135 (0%)

Sandboxed builds already run in a pseudo-terminal whose output the parent brew process relays in Sandbox#copy_pty_output. For builds, BuildProgress#forward takes over that relay: it clears the status line before each chunk of output and redraws it afterwards, so the ==> lines, patch output and warnings always print above it. It reuses the download queue's spinner.

The step progress is read from the tail of the newest log in formula.logs, so Formula#system is unchanged and build commands still write straight to their logs. Compiler wrapper (*.cc.log) and sandbox logs are skipped, as are logs from before the build started.

While a build runs, Ctrl-C goes to the build's pseudo-terminal rather than to brew, so the parent only sees the ^C it echoes. Once that appears the status line stops being drawn, as the progress no longer matters while the build is being interrupted.

Nothing changes with --verbose, --debug or --interactive, when output isn't a terminal or TERM=dumb, or for builds that don't run in the sandbox.

To see it, build any formula from source that uses CMake or Ninja, e.g. brew install --build-from-source llvm.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Code (Claude Opus 5.5) wrote the change, its tests and this description. Verified with brew typecheck, brew style, the affected specs and a source build of llvm on macOS 12 for the examples above.


- Builds without `--verbose` print nothing while a command runs, so
  long ones such as `llvm` from source look stuck for hours.
- The sandbox already relays the build's pseudo-terminal output, so
  keep a spinner below that output for the whole build, including
  startup, checksum checks and unpacking.
- Show Ninja (`[12/345]`) or CMake (`[ 42%]`) step progress next to
  it, read from the newest build log, so `Formula#system` keeps
  writing straight to the log.
- Stop drawing once a Ctrl-C is echoed, as the progress no longer
  matters while the build is being interrupted.
@MikeMcQuaid

Copy link
Copy Markdown
Member

Sorry, passing on this. Building from source is not a supported user configuration and don't want to add dedicated code here when we already have e.g. --verbose for more explicit output.

@HaraldNordgren

Copy link
Copy Markdown
Contributor Author

@MikeMcQuaid Fair enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants