[SOLVED] Failed Homebrew “brew update”

Posted about 3 years ago

After upgrading my Mac OS to “El Capitan” I’m returned the following error.

Error: /usr/local must be writable!

This isn’t a problem with Homebrew, but during the upgrade the OS has reset the permissions on /local

To solve this problem, you can run the command “brew doctor” which will give you more details. I receive the following.

You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami) /usr/local

So run the command

sudo chown -R $(whoami) /usr/local

You can now run brew update

Note: I still had a few problems after changing the ownership and I needed to run further commands.

echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc 
brew install libxml2

After running brew doctor again, I noticed I still had a couple of warnings.

Warning: Homebrew’s sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so
  echo ‘export PATH=”/usr/local/sbin:$PATH”’ >> ~/.zshrc

Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:
  brew install libxml2

Alternatively, you could install Homebrew in a location where it doesn’t require admin privileges

Still having trouble?

If you’re still having trouble, you can uninstall Homebrew easily with one command

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

Then run the install again

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