Reputation: 6810
I removed ALL content from /usr/local/bin folder (including 'brew'). Homebrew isn't working anymore and I seem to be stuck in a limbo. When I try to install it says:
It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
When I run the given uninstall command it says:
Failed to locate Homebrew!
Background
The problem arose when I attempted to remove node.js by following this guide: https://stackoverflow.com/a/11178106/1736012
To completely uninstall node + npm is to do the following:
- go to /usr/local/lib and delete any node and node_modules
- go to /usr/local/include and delete any node and node_modules directory
- if you installed with brew install node, then run brew uninstall node in your terminal
- check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
- go to /usr/local/bin and delete any node executable
Especially 5 was bad! That's what led me to remove everything under /usr/local/bin. So brew doctor
won't work (brew isn't recognized anymore). Brew worked fine before this.
What I tried
This does not work either as brew is missing:
rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )"
I tried various scripts like this one for example: https://apple.stackexchange.com/a/85481. And this: https://gist.github.com/SteveBenner/11254428. None of them is working (both assumes that brew command is there)...
What can I do to re install Homebrew so that it works as before??
Upvotes: 1
Views: 13107
Reputation: 4968
I faced the same issue, the following link really worked for me https://github.com/Homebrew/brew/issues/10368
especially comment from MrBenFTW commented on Feb 2021
Upvotes: 0
Reputation: 31339
This should bring back a working brew
command:
cd /usr/local/Homebrew
git init
git remote add origin https://github.com/Homebrew/homebrew
git pull origin master
Next I would check the output of brew doctor
and see if there are major problems. There is an official uninstalling guide on homebrew
's github
wiki in case you want to completely uninstall.
Upvotes: 4
Reputation: 31
Try to move or remove the Homebrew file in the user/local file and then try the regular link from the homebrew homepage to install the brew!
By the way, I did not try moving but I am pretty sure it should work.
Note: While the operation you might have to use the sudo
Upvotes: 0