Jeremy Hadfield
Jeremy Hadfield

Reputation: 189

Installing Homebrew on Macbook running El Capitan

When I run this command:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

I get the following error:

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)"
The current contents of /usr/local are bin CODEOFCONDUCT.md git include lib libexec Library LICENSE.txt n share var .git .github .gitignore

However, when I run brew doctor, this error is thrown:

bash: brew: command not found

And when I try to un-install Homebrew using this script:

sudo  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

my command prompt responds with:

Failed to locate Homebrew!

Please help.

Upvotes: 2

Views: 1566

Answers (2)

SoAwesomeMan
SoAwesomeMan

Reputation: 3396

First delete all homebrew files manually. Then reinstall Homebrew from scratch. Prefix sudo at your own discretion:

# packages
rm -rf /usr/local/Cellar

# executable
rm /usr/local/bin/brew

# meta
rm -rf /usr/local/.git
rm /usr/local/.github
rm /usr/local/.gitignore
rm /usr/local/.travis.yml
rm /usr/local/.yardopts
rm /usr/local/CODEOFCONDUCT.md
rm /usr/local/LICENSE.txt
rm /usr/local/README.md

# home
rm ~/.rvm/bin/brew
rm ~/.homebrew
rm -rf ~/Library/Caches/Homebrew
rm -rf ~/Library/Logs/Homebrew

# other
rm -rf /Library/Caches/Homebrew

# find more files to delete; delete Homebrew files only!
find / -name "*brew*"

IMPORTANT: because of permission errors upon reinstall, you may have to do one of the following steps before reinstallation; see: https://github.com/Homebrew/legacy-homebrew/issues/15138

# via: https://github.com/Homebrew/legacy-homebrew/issues/15138#issuecomment-19258042
cd /usr/local
sudo mv -v Library Library.old

# --OR--

# via: https://github.com/Homebrew/legacy-homebrew/issues/15138#issuecomment-33338868
# see: http://linuxcommand.org/man_pages/chmod1.html
cd /usr/local
chmod -R 775 Library

Reinstall Homebrew; see: http://brew.sh

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Upvotes: 2

Barremian
Barremian

Reputation: 31105

There is a problem related to the latest version of XCode and Homebrew. Open a terminal and run:

rm -rf /usr/local/Cellar /usr/local/.git
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If you get permission denied error use sudo. Directory /usr/local/Cellar/ is completely removed when uninstalling Homebrew, so it is safe to remove it.

Upvotes: 1

Related Questions