Skip to content

brew tab --no-installed-on-request does not work as expected #21751

@kidonng

Description

@kidonng

brew doctor output

Your system is ready to brew.

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
ORIGIN: https://github.com/Homebrew/brew
HEAD: 4135badeddc3899aa2e89d3ea1caee320c55d299
Last commit: 6 days ago
Branch: stable
Core tap JSON: 17 Mar 13:24 UTC
Core cask tap JSON: 17 Mar 13:24 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DOWNLOAD_CONCURRENCY: 28
HOMEBREW_EDITOR: code --wait
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 14
Homebrew Ruby: 4.0.1 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.1/bin/ruby
CPU: 14-core 64-bit arm_brava
Clang: 17.0.0 build 1700
Git: 2.50.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/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 did routine update, upgrade, cleanup combo, ant got a message:

$ brew cleanup
Warning: Skipping sqlite: most recent version 3.51.3 not installed

Which led me to Homebrew/homebrew-core#272250 (comment). I then ran brew reinstall sqlite as mentioned, terminated it due to network issues (which left a 3.52.0.reinstall folder in the Cellar), and reran.

Then I ran brew bundle dump --global --force, and found sqlite in ~/.Brewfile.

I have met similar issues before (#18754) so I thought brew tab --no-installed-on-request would fix its status, but after another dump I still saw sqlite.

And I realized installed_as_dependency is set to false, which is likely due to my termination above:

$ jq .installed_as_dependency /opt/homebrew/Cellar/sqlite/3.51.3/INSTALL_RECEIPT.json
false

(sqlite is installed as a dependency on my system.)

$ brew uses --installed sqlite
corepack          deno              mpv               node              python@3.14       vapoursynth       yt-dlp

And according to the implementation, I would indeed get sqlite dumped regardless of how I change installed_on_request:

requested_formula = formulae.select do |f|
f[:installed_on_request?] || !f[:installed_as_dependency?]
end

What happened (include all command output)?

I need to manually edit INSTALL_RECEIPT.json to correct sqlite's installation status.

What did you expect to happen?

I see 3 potential issues here:

  1. Reinstall (of termination of it) should not change its installation status (either installed_as_dependency or installed_on_request), at least this is how I expected
  2. As the title says, brew tab --no-installed-on-request in this scenario made no actual effect, brew bundle still did its thing
  3. I'm not familiar with all usage of these two status fields, but they seem mutually exclusive, so should not be two separate fields which could go out of sync like in my scenario.

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

$ brew install cowsay
$ brew bundle dump --global --force
$ grep cowsay ~/.Brewfile
brew "cowsay"
$ brew tab --no-installed-on-request cowsay
$ grep cowsay ~/.Brewfile
brew "cowsay"

Metadata

Metadata

Assignees

No one assigned

    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