Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best/safest way to reinstall Homebrew?

Tags:

macos

homebrew

I am getting issues with permissions in Homebrew: After I installed Node and tried to install npm using the curl command Homebrew tells you to use, it would fail due to EACCESS errors. I checked the node folder and the permissions were a) unowned by a user (I had to chown it) and b) Had no write permissions (I had to chmod 755 it).

I've fixed the issue with NPM, but I had to run its install script as sudo (which is bad!).

I assume I must have installed Homebrew as root or something similar. I am hoping that reinstallation will fix it, but I can't find a source on how to reinstall Homebrew.

When I rerun the installer in Terminal I get:

/usr/local/.git already exists! 
like image 259
AndrewKS Avatar asked Jun 14 '12 17:06

AndrewKS


People also ask

What happens if you install Homebrew twice?

Homebrew will just download the files needed to brew the formula, then run the configuration and compilation by itself. This shouldn't be an issue since all formulae live in their own respective folders – except for the very rare cases when you happen to install two formulae concurrently which have the same dependency.

Is Homebrew safe for Mac?

Homebrew on its own acts like a command-line App Store. It's safe, if you know what you're downloading. It uses SHA256 to fingerprint the downloaded instructions as a validity / tamper detection verification check. It's open, so you could validate what it's downloading and how it works.


1 Answers

Update 10/11/2020 to reflect the latest brew changes.

Brew already provide a command to uninstall itself (this will remove everything you installed with Homebrew):

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)" 

If you failed to run this command due to permission (like run as second user), run again with sudo

Then you can install again:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 
like image 91
Ming C Avatar answered Sep 19 '22 04:09

Ming C