Macos – HomeBrew error message OSX

homebrewmacospermissions

I have installed the latest Brew on OSX. On running update or installing new formulas I get the following error:

Error: The following directories are not writable by your user:

/usr/local/share/man/man5

You should change the ownership of these directories to your user.

sudo chown -R $(whoami) /usr/local/share/man/man5

And make sure that your user has write permission.

chmod u+w /usr/local/share/man/man5

At the moment I cannot find any information on what this means in context to brew. My goal is to understand it and not just do the permission change without understanding the implications or why that directory doesn't have the right permission.

Thank you in advance.

Best Answer

No one can give you a definite answer about the cause according only the info given from the description.

The most likely reason is that you used sudo with command brew, and the owner of some folder under /usr/local was changed to root.

Fix permission recursively,

sudo chown "$(whoami)":admin /usr/local/*

Note: Homebrew doesn't require root permission, never use sudo with command brew.

BTW, maybe brew doctor will provide more info about this problem.

Related Question