Upgrading brew in El Capitan

I just upgraded to El Capitan, and when I tried updating brew I got the following error:

$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.

You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami):admin /usr/local

Before I proceed with the chown recommendation, given that El Capitan just came out, is that the right way to proceed here? Why is this step necessary, and what are any potential undesirable consequences of running this command?

In case it helps, I found two issues about El Capitan in brew: 40837 and 41665 but a solution to this problem wasn't immediately clear. What can I do to continue to use brew in El Capitan reliably?


Solution 1:

I mean they give you the solution right there. I had the same problem and I just ran:

  sudo chown -R $(whoami):admin /usr/local

and it worked.

Solution 2:

We no longer need to break our heads about this. I risked the advice and did the suggested permission change. Then, on updating to the latest homebrew I got this reassuring message:

Homebrew no longer needs to have ownership of /usr/local. If you wish you can return /usr/local to its default ownership with: sudo chown root:wheel /usr/local

Solution 3:

Per some of the security questions above, the dialog does give instructions to reset after a successful brew update. After running

sudo chown -R $(whoami) /usr/local

And then

brew update

After the update has successfully run, the dialog should indicate doing this:

sudo chown root:wheel /usr/local

After that has been run, that should alleviate any security concerns with MacOS 10.12

Solution 4:

The given solution did not work for me:

sudo chown -R $(whoami):admin /usr/local

This variation worked for me:

sudo chown -R $USER /usr/local/