Trying to install something using Homebrew you got the following error
1 |
Error: Permission denied - /usr/local/[WHATEVER] |
Are you wondering how to fix it?
Permission troubles in our Mac and Linux systems happend for several reasons like an upgrade of your operating system, an incorrect user, …
Fortunately, Homebrew gives us a tool to check why it is not working properly and what can we use to repair it:
1 |
$ brew doctor |
In this case, this command responses that the solution for this issue is to change the own permissions of the /usr/local folder to the current user. And we can do it with the following:
1 |
sudo chown -R $(whoami) /usr/local |
This solution is simple and effective because the default installation folder of Homebrew is /usr/local and setting the owner permissions for the current user will grant access to that user to everything in that folder. However, you must be careful if you installed in this folder some application with concrete permissions, because it would cease to work.
I hope that this solution works to you and if you have some question feel free to say it, I will do my best trying to help you.