OSX Tip: Fix permissions issue during Homebrew update

If you get the following error while trying to update your Homebrew (Mac OSX package manager)

~/ brew update
fatal: Unable to create '/usr/local/.git/index.lock': Permission denied
Error: Failure while executing: git checkout -q master

Usually means that the current user does not have permissions to update homebrew. Because homebrew by default is installed for access by a specific user. You can fix the above error by executing the following two statements in your terminal window:

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

Step 1 – makes sure that the admin group owns /usr/local

Step 2 – makes /usr/local writable by the admin group

Assumptions – The above two steps assumes the current user is part of the admin group.

Hope this helps.

8 comments for “OSX Tip: Fix permissions issue during Homebrew update

  1. November 18, 2013 at 10:31 pm

    It worked like a charm!
    Thanks a lot!


  2. November 19, 2013 at 6:49 pm

    perfect, thanks much!

  3. David Sadler
    June 14, 2014 at 3:14 pm

    Thanks for the fix! Worked perfect.

  4. Emma
    June 30, 2014 at 1:16 pm

    Thanks so much this was the perfect solution!!

  5. March 17, 2015 at 7:12 pm

    Work perfect !!
    Thank you great solution.

  6. julia
    May 27, 2015 at 10:24 pm

    Thanks so much it works!

  7. Alex Mendez
    September 27, 2015 at 4:39 am

    Thanks so much, was stuck on this problem for a hot second

  8. Leon
    July 27, 2018 at 5:26 am

    Try this for High Sierra

    sudo chown -R $(whoami) $(brew –prefix)/*

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.