4

i have tried sudo chown $whoami /usr/local/bin , after closing terminal and reopening terminal but it keeps getting permission denied, it doesn't fix it permanently.

shaunstanislaus@Master ~ $ brew upgrade
==> Upgrading 3 outdated packages, with result:
git 2.6.1, mysql 5.6.27, node 4.1.2
==> Upgrading git
Error: Permission denied - /usr/local/share/git-core
Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142
Shaun Stanislaus
  • 511
  • 1
  • 6
  • 20

1 Answers1

3

You will need to chown (change ownership) of the /usr/local/bin /usr/local/share, /usr/local/share/man and /usr/local/share/man/man1 directories.

To do this you do the following:

  1. whoami - this will give you your current username
  2. sudo chown -R 'username' /usr/local/bin /usr/local/share /usr/local/share/man /usr/local/share/man/man1 (replace username with the username from step 1)

Now run brew doctor

You shouldn't see any issues.

Then run brew upgrade

If you are using Sophos Anti-Virus, the permissions will be reset each time Sophos updates in the background.

They are pursuing a fix for this and will be in place by mid Nov 2015 according to this forum post:

https://community.sophos.com/products/free-antivirus-tools-for-desktops/f/17/t/10029

Sourabh Kumar Sharma
  • 2,864
  • 3
  • 25
  • 33
tattvabodha
  • 111
  • 1
  • 1
  • 8