Homebrew cannot find any packages, reinstalling does not help

  1. Got Mac Pro back from shop after hard drive failure (OS Catalina 10.15.5)
  2. Installed homebrew from link at brew.sh
  3. brew install rbenv -> " No available formula with the name…"
  4. asked at stackoverflow, no answers.
  5. uninstalled homebrew via the bash script from github homebrew repo
  6. Installed homebrew from link at brew.sh
  7. brew update -> “Already up to date.”
  8. brew install wget -> “No available formula with the name …”
  9. brew search wget -> “No formula or cask found for …”
brew tap homebrew/core
Error: Tap homebrew/core remote mismatch.
https://github.com/Homebrew/brew != https://github.com/Homebrew/homebrew-core

but .git/config at /usr/local/Homebrew and at /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git/config has https://github.com/Homebrew/brew as source.


Please help. What am I doing wrong.

What do brew config and brew doctor say?

brew config
HOMEBREW_VERSION: 2.5.1-26-g21d4c1f
ORIGIN: https://github.com/Homebrew/brew
HEAD: 21d4c1ffc7b839c5638384d527613cbbc2487fa5
Last commit: 6 hours ago
Core tap ORIGIN: https://github.com/Homebrew/brew
Core tap HEAD: 21d4c1ffc7b839c5638384d527613cbbc2487fa5
Core tap last commit: 6 hours ago
Core tap branch: master
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: quad-core 64-bit kabylake
Clang: 11.0 build 1103
Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 10.15.5-x86_64
Xcode: N/A

brew doctor gives me alert to change /usr/local/Homebrew git config to the current repo, and overwrites the git config in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git/config to old repo, when i run brew doctor again it alerts me on the wrong git config in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git/config and rewrites the one in /usr/local/Homebrew

=> I ended up just editing both configs manually and not running brew doctor anymore. Solved nothing but brew update now hangs instead of saying up-to-date.

Somehow, you managed to set both Homebrew software and core tap to the same remote. Do this to set things aright:

git -C $(brew --repo homebrew/core) remote set-url origin https://github.com/Homebrew/homebrew-core
brew update-reset

Hm. Did that. brew update-reset pulled from master but then crashed at

==> Resetting /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
/usr/local/Homebrew/Library/Homebrew/brew.sh: line 100: /usr/local/Homebrew/Library/Homebrew/shims/scm/git: No such file or directory
/usr/local/Homebrew/Library/Homebrew/brew.sh: line 100: /usr/local/Homebrew/Library/Homebrew/shims/scm/git: No such file or directory

==> Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
/usr/local/Homebrew/Library/Homebrew/brew.sh: line 100: /usr/local/Homebrew/Library/Homebrew/shims/scm/git: No such file or directory
/usr/local/Homebrew/Library/Homebrew/brew.sh: line 100: /usr/local/Homebrew/Library/Homebrew/shims/scm/git: No such file or directory

and now there is no brew:

$ which brew
brew not found

/usr/local/Homebrew/ directory is still there but /usr/local/Homebrew/bin no longer.

Looks like your setup is seriously b0rked. Probably best to uninstall and reinstall at this point.

Can’t even do that :frowning:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

/bin/bash: line 193: brew: command not found
Failed to locate Homebrew!

Try running
git -C /usr/local/Homebrew/ remote set-url origin https://github.com/Homebrew/brew.git
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/ remote set-url origin https://github.com/Homebrew/homebrew-core

and after that running brew doctor again

Eventually I had to manually remove /usr/local/Homebrew, then install again. Homebrew now works!

Thanks for help.