Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.18k stars 9.67k forks source link

brew autoremove not removing stuff #18529

Open dimaqq opened 2 weeks ago

dimaqq commented 2 weeks ago

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:
  meld

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  juju-wait

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae and may need to be deleted.

Unexpected header files:
  /usr/local/include/node/cppgc/common.h
  /usr/local/include/node/js_native_api.h
[so many files]
  /usr/local/include/node/zlib.h

Warning: Homebrew's "sbin" was not found in your PATH but you have installed
formulae that put executables in /opt/homebrew/sbin.
Consider setting your PATH for example like so:
  fish_add_path /opt/homebrew/sbin

Verification

brew config output

HOMEBREW_VERSION: 4.4.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 84c31175f11860129a9aaed40a13c549625e2db1
Last commit: 7 days ago
Core tap JSON: 08 Oct 06:42 UTC
Core cask tap JSON: 08 Oct 06:42 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: vim
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.3.5 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/bin/ruby
CPU: octa-core 64-bit arm_blizzard_avalanche
Clang: 16.0.0 build 1600
Git: 2.47.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.0.1-arm64
CLT: 16.0.0.0.1.1724870825
Xcode: N/A
Rosetta 2: false

What were you trying to do (and why)?

Trying to remove stale deps. I ran "brew upgrade" and there were so many, what's "wangle"?

I've checked brew deps --tree --installed | view - and realised that was brought in by watchman.

I removed watchman, but that didn't remove edencommon. So I removed edencommon, but that didn't remove fb303. etc. etc.

What happened (include all command output)?

brew remove fbthrift Uninstalling /opt/homebrew/Cellar/fbthrift/2024.10.07.00... (881 files, 27.6MB)

brew autoremove [no output; retval OK]

What did you expect to happen?

for brew to remove the stale deps

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

Weirdly, if I `brew install watchman` again, it installs 3 packages (watchman, fb303, edencommon) and reuses the other deps.

When `brew remove watchman` it removes (edencommon,fb303,fbthrift) and doesn't remove the other deps.

It's as if my system state got weird, as if every dependency got marked as "explicitly installed".
dimaqq commented 2 weeks ago

P.S. doctor output doesn't say ready to brew maybe doctor output was changed? It does tell me that everything is working fine.

gromgit commented 2 weeks ago

It's as if my system state got weird, as if every dependency got marked as "explicitly installed".

What's the output of brew leaves --installed-on-request? These are the formulae that are not used by other installed formulae, but will never be autoremoved, because you either did brew install for them at some point, or your Homebrew state "got weird" somehow.

Make a list of the formulae above that you're absolutely sure you never manually installed and you don't want on your system at this point, then:

brew tab --no-installed-on-request <list_of_non-manually-installed_formulae>

then a subsequent brew autoremove should do what you intended.