Skip to content

brew bundle remove does not clean up descriptions in Brewfile #21732

@korthout

Description

@korthout

brew doctor output

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed casks are deprecated or disabled.
You should find replacements for the following casks:
  intellij-idea-ce

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  icu4c@77

Verification

  • I ran brew update twice and am still able to reproduce my issue.
  • My "brew doctor output" above says Your system is ready to brew or a definitely unrelated Tier message.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

HOMEBREW_VERSION: 5.1.0-14-g30f9c6f
ORIGIN: https://github.com/Homebrew/brew
HEAD: 30f9c6f01aa296c946715c3235ef35749b4b5497
Last commit: 24 hours ago
Branch: main
Core tap JSON: 14 Mar 09:32 UTC
Core cask tap JSON: 14 Mar 09:32 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DOWNLOAD_CONCURRENCY: 16
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_FORCE_BREWED_CURL: set
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_INSTALL_CLEANUP: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 4.0.1 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.1/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 17.0.0 build 1700
Git: 2.53.0 => /opt/homebrew/bin/git
Curl: 8.19.0 => /opt/homebrew/opt/curl/bin/curl
macOS: 26.3.1-arm64
CLT: 26.3.0.0.1.1771626560
Xcode: N/A
Rosetta 2: false

What were you trying to do (and why)?

I was removing a bundle entry with brew bundle remove because I no longer needed the associated package/cask/formula.

What happened (include all command output)?

After running brew bundle remove --global formula, the corresponding brew bundle dump --describe comment/description lines remained in the Brewfile. This left orphaned comments and clutter (lines beginning with # ...) for entries that were supposedly removed. For example:

# foobar: a useful tool
brew "foobar"

If I remove "foobar", the comment/description is still present:

# foobar: a useful tool

What did you expect to happen?

brew bundle remove should also remove or clean up any description/comment lines that were generated for that entry by brew bundle dump --describe, so that leftover comments do not clutter the Brewfile.

Step-by-step reproduction instructions (by running brew commands)

# Install git as example and dump the Brewfile with descriptions


brew install git
brew bundle dump --describe --global


# Brewfile now contains the following:


# Distributed revision control system
brew "git"


# Remove git from Brewfile


brew bundle remove --global git


# Observe that description/comment lines for removed entry remain and are not cleaned up


# Distributed revision control system

Metadata

Metadata

Assignees

Labels

help wantedWe want help addressing this

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions