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??
This should bring back a working
brew
command:Next I would check the output of
brew doctor
and see if there are major problems. There is an official uninstalling guide onhomebrew
'sgithub
wiki in case you want to completely uninstall.