I ran the following command on terminal (Mac El Capitan)
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
and got the following error message:
Failed during: git fetch origin master:refs/remotes/origin/master -n --depth=1
Additionally tried:
sudo chown $(whoami):admin /usr/local && sudo chown -R $(whoami):admin /usr/local
then the two commands above.
Any idea how to install Homebrew?
brew is not recognized
and ruby version 2.0.0
, git version 2.7.4
After a few hours of research and brute force I learned the issue was due to git not being configured properly. Some articles suggested downgrading your git or reinstalling all together. However, I resolved the issue just by adding the following
git config --global user.email [email protected]
Then remove the cellar
and homebrew
directories from /usr/local
and re-try the installation.
run.sh
rm -rf /usr/local/bin/brew
rm -rf /usr/local/share/doc/homebrew
rm -rf /usr/local/share/man/man1/brew.1
rm -rf /usr/local/share/zsh/site-functions/_brew
rm -rf /usr/local/etc/bash_completion.d/brew
rm -rf /usr/local/Homebrew
sh run.sh
Or, just run all these commands manually one by one.
@ashdaily commands worked for me, addindg sudo
on last command and then executing also the @Sinux command too:
rm -rf /usr/local/bin/brew
rm -rf /usr/local/share/doc/homebrew
rm -rf /usr/local/share/man/man1/brew.1
rm -rf /usr/local/share/zsh/site-functions/_brew
rm -rf /usr/local/etc/bash_completion.d/brew
sudo rm -rf /usr/local/Homebrew
rm -rf /opt/homebrew
Fastest and easiest way is to uninstall Homebrew by following command -
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
and after this, fresh install of Homebrew by following command -
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Steps to fix it on Big Sur (2021):
git config --global user.email [email protected]
/usr/local
Works for me on Big Sur.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With