[brew] Error: /usr/local must be writable!


First if you want to update the homebrew to the recent version you can use this command:

brew update

But recently I got a error message when I run this command:

Error: /usr/local must be writable!

It seems like I do not have the permission to access this directory. Indeed I do not have the permission of this directory, because this directory belongs to wheel group.

After google some solutions, I solved this by the following method:

Change the group and give a write permission of this directory and all the sub files or directory with this two command.

sudo chgrp -R admin /usr/local
sudo chmod -R g+x /usr/local

Then run the brew update.

That's all.