'Unable to install wget

My MacBook Air was equipped with macOS Mojave Version 10.14.6. I cannot install wget even if I have checked brew version.

brew --version

The output is :

Homebrew 3.3.13
Homebrew/homebrew-core (no Git repository)
Homebrew/homebrew-cask (git revision fb6ec06d8b; last commit 2022-01-31)

When I tried to install wget:

brew install wget

This is the result:

Warning: No available formula with the name "ca-certificates".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Running `brew update --preinstall`...
Error: No formulae found in taps.
fatal: Could not resolve HEAD to a revision
Warning: No available formula with the name "wget".
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

This problem has bothered me for a long while...



Solution 1:[1]

Eventually, I solved this problem by running the following code:

brew update-reset
brew install wget

I hoped this may help others.

Solution 2:[2]

Problem could be 'Homebrew/homebrew-core not tapped properly'. Executing these two commands resolved the issue for me.

rm -rf "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core"
brew tap homebrew/core

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ken Hsu
Solution 2 Aftaab Siddiki