Zaher Ghaibeh
PHP Backend developer
I've experience in a few PHP Frameworks, such as Laravel, Lumen and Slim (The last two are used for building Microservices/API services).
Fixing brew "permission denied" problem
Published at Sunday, September 2, 2018

Today I was trying to install a tool called mackup, which will help backup/restore your configurations to/from Dropbox.

As this is the first time for me to use it, I choose the simple way to install it, homebrew, the command was clear and simple

brew install mackup

But sadly I faced a problem with the permission to create a folder within the directory /usr/local/ which is needed to install python 3, so after I looked around, I found that the best solution will be to :

  1. Restart in rescue mode.
  2. Disable System integrity using the command csrutil disable
  3. Restart back and run the command sudo chmod -R $(whoami) /usr/local.
  4. Restart back to rescue mode.
  5. Enable System integrity using the command csrutil enable
  6. Restart back in normal mode and run the install command again.

Now running brew install mackup will work without any problem, as the core problem in my case related to the fact that virtualbox has installed some python library using root permission to python 2.7 site-packages directory, no idea what is the relationship between those two, but the trick has solved my problem, and I hope it will help you too.