can't chown /usr/local for homebrew in Mac OS X 10.13 High Sierra

Dan picture Dan · Sep 28, 2017 · Viewed 62.8k times · Source

Homebrew needs permissions in /usr/local and since no one else uses my laptop I have always simply done

sudo chown -R $(whoami) $(brew --prefix)

but in High Sierra, this gives

chown: /usr/local: Operation not permitted

What is the fix?

Answer

Uri Meirav picture Uri Meirav · Nov 16, 2017

The problem kept occurring... after digging deeper I found that only uninstalling Homebrew and then re-installing it solved this issue.

Uninstall Homebrew:

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

Then re-install it:

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