こまった!brew updateが動かない。。

% brew update
error: unable to unlink old 'share/man/man1/brew.1' (Permission denied)
Error: Failure while executing: git pull --ff --no-rebase --quiet origin refs/heads/master:refs/remotes/origin/master

のような表示が出て、brew updateの実行がうまくいかない。。。><

【結論】brew doctorを使えばよい。

brew doctor
% brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: /usr/local/share isn't writable.

This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

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

Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.

You should probably `sudo chown -R $(whoami)` them:
    /usr/local/share/man
    /usr/local/share/man/man1

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
    autoconf
    pkg-config

Warning: You have uncommitted modifications to Homebrew
If this is a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
    cd /usr/local/Library && git stash && git clean -d -f

Warning: Xcode 7 lacks the 10.10 SDK which can cause some builds to fail.
We recommend installing the Command Line Tools with:
  xcode-select --install
to resolve this issue.

みたいにな表示が出るので、 上の方からコマンドをポチポチ実行していけば良い。