Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homebrew cleanup message appearing after every command #17869

Closed
3 tasks done
tgaeta opened this issue Jul 26, 2024 · 4 comments
Closed
3 tasks done

Homebrew cleanup message appearing after every command #17869

tgaeta opened this issue Jul 26, 2024 · 4 comments
Labels
bug Reproducible Homebrew/brew bug

Comments

@tgaeta
Copy link

tgaeta commented Jul 26, 2024

brew doctor output

brew doctor
Your system is ready to brew.
Usage: brew cleanup [options] [formula|cask ...]

Remove stale lock files and outdated downloads for all formulae and casks, and
remove old versions of installed formulae. If arguments are specified, only do
this for the given formulae and casks. Removes all downloads more than 120 days
old. This can be adjusted with HOMEBREW_CLEANUP_MAX_AGE_DAYS.

      --prune                      Remove all cache files older than specified
                                   days. If you want to remove everything, use
                                   --prune=all.
  -n, --dry-run                    Show what would be removed, but do not
                                   actually remove anything.
  -s, --scrub                      Scrub the cache, including downloads for even
                                   the latest versions. Note that downloads for
                                   any installed formulae or casks will still
                                   not be deleted. If you want to delete those
                                   too: rm -rf "$(brew --cache)"
      --prune-prefix               Only prune the symlinks and directories from
                                   the prefix and remove no other files.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.
Error: invalid option: -l

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • 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

brew config
HOMEBREW_VERSION: 4.3.10
ORIGIN: https://github.com/Homebrew/brew
HEAD: c3ae0327c01aab461531bfc0fcdfb4dd3a779205
Last commit: 8 days ago
Core tap JSON: 26 Jul 13:56 UTC
Core cask tap JSON: 26 Jul 13:56 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.3.3 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.3/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.45.1 => /opt/homebrew/bin/git
Curl: 8.6.0 => /usr/bin/curl
macOS: 14.5-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: N/A
Rosetta 2: false
Usage: brew cleanup [options] [formula|cask ...]

Remove stale lock files and outdated downloads for all formulae and casks, and
remove old versions of installed formulae. If arguments are specified, only do
this for the given formulae and casks. Removes all downloads more than 120 days
old. This can be adjusted with HOMEBREW_CLEANUP_MAX_AGE_DAYS.

      --prune                      Remove all cache files older than specified
                                   days. If you want to remove everything, use
                                   --prune=all.
  -n, --dry-run                    Show what would be removed, but do not
                                   actually remove anything.
  -s, --scrub                      Scrub the cache, including downloads for even
                                   the latest versions. Note that downloads for
                                   any installed formulae or casks will still
                                   not be deleted. If you want to delete those
                                   too: rm -rf "$(brew --cache)"
      --prune-prefix               Only prune the symlinks and directories from
                                   the prefix and remove no other files.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.
Error: invalid option: -l

What were you trying to do (and why)?

I was trying to use various commands for normal day-to-day operations:

  • cd sandbox
  • code .
  • brew config

What happened (include all command output)?

After every command, regardless of its purpose or success, the following message appears:

Usage: brew cleanup [options] [formula|cask ...]
Remove stale lock files and outdated downloads for all formulae and casks, and
remove old versions of installed formulae. If arguments are specified, only do
this for the given formulae and casks. Removes all downloads more than 120 days
old. This can be adjusted with HOMEBREW_CLEANUP_MAX_AGE_DAYS.
      --prune                      Remove all cache files older than specified
                                   days. If you want to remove everything, use
                                   --prune=all.
  -n, --dry-run                    Show what would be removed, but do not
                                   actually remove anything.
  -s, --scrub                      Scrub the cache, including downloads for even
                                   the latest versions. Note that downloads for
                                   any installed formulae or casks will still
                                   not be deleted. If you want to delete those
                                   too: rm -rf "$(brew --cache)"
      --prune-prefix               Only prune the symlinks and directories from
                                   the prefix and remove no other files.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.
Error: invalid option: -l

What did you expect to happen?

I expected commands to execute normally without this cleanup message appearing every time.

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

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

Run any Homebrew command, for example:
brew update

Observe the normal output of the command.
Notice that the cleanup message appears at the end of the output.

Try another command, such as:
brew config

Again, observe that the cleanup message appears after the normal output.

This behavior occurs consistently with every terminal command, including brew --version, brew doctor, etc.

Additional Information:

- The issue persists after running brew update multiple times.
- The main brew script at /opt/homebrew/bin/brew appears to be normal and unmodified.
- The brew --version command outputs the version number correctly without the cleanup message.
- The issue occurs in both interactive and non-interactive shell sessions.
@tgaeta tgaeta added the bug Reproducible Homebrew/brew bug label Jul 26, 2024
@gromgit
Copy link
Member

gromgit commented Jul 26, 2024

This behavior occurs consistently with every terminal command, including brew --version, brew doctor, etc.
[...]
The brew --version command outputs the version number correctly without the cleanup message.

So does brew --version work correctly, or not? I'm betting it fails just like all the others, but please confirm one way or another.

Also, what's the output of type brew?

@tgaeta
Copy link
Author

tgaeta commented Jul 26, 2024

@gromgit Sorry for not mentioning in the original bug report, but I also ran those commands as well:

brew --version
Homebrew 4.3.10
Usage: brew cleanup [options] [formula|cask ...]

Remove stale lock files and outdated downloads for all formulae and casks, and
remove old versions of installed formulae. If arguments are specified, only do
this for the given formulae and casks. Removes all downloads more than 120 days
old. This can be adjusted with HOMEBREW_CLEANUP_MAX_AGE_DAYS.

      --prune                      Remove all cache files older than specified
                                   days. If you want to remove everything, use
                                   --prune=all.
  -n, --dry-run                    Show what would be removed, but do not
                                   actually remove anything.
  -s, --scrub                      Scrub the cache, including downloads for even
                                   the latest versions. Note that downloads for
                                   any installed formulae or casks will still
                                   not be deleted. If you want to delete those
                                   too: rm -rf "$(brew --cache)"
      --prune-prefix               Only prune the symlinks and directories from
                                   the prefix and remove no other files.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.
Error: invalid option: -l
type brew
brew is /opt/homebrew/bin/brew
Usage: brew cleanup [options] [formula|cask ...]

Remove stale lock files and outdated downloads for all formulae and casks, and
remove old versions of installed formulae. If arguments are specified, only do
this for the given formulae and casks. Removes all downloads more than 120 days
old. This can be adjusted with HOMEBREW_CLEANUP_MAX_AGE_DAYS.

      --prune                      Remove all cache files older than specified
                                   days. If you want to remove everything, use
                                   --prune=all.
  -n, --dry-run                    Show what would be removed, but do not
                                   actually remove anything.
  -s, --scrub                      Scrub the cache, including downloads for even
                                   the latest versions. Note that downloads for
                                   any installed formulae or casks will still
                                   not be deleted. If you want to delete those
                                   too: rm -rf "$(brew --cache)"
      --prune-prefix               Only prune the symlinks and directories from
                                   the prefix and remove no other files.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.
Error: invalid option: -l

I think this is a one-time thing. No one else reported it. I tried downgrading but still got the Error: invalid option: -l. Yesterday, everything was fine. This morning, I sat down to work, and the error came up.

@gromgit
Copy link
Member

gromgit commented Jul 27, 2024

OK, so your brew isn't a wrapper or something else that's running brew cleanup with improper args. That leaves:

  • a changed Homebrew install - brew update-reset should take care of that, or
  • (more likely, if it happens with non-homebred commands like ls as well) it's being run by your shell before each prompt - check $PROMPT_COMMAND (bash) or your precmd-related hooks (zsh)

@tgaeta
Copy link
Author

tgaeta commented Jul 27, 2024

brew update-reset indeed resolved this issue for me. Thank you @gromgit 🙇

@tgaeta tgaeta closed this as completed Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/brew bug
Projects
None yet
Development

No branches or pull requests

2 participants