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.