brew update で …/kernel_require.rb:55:in `require’: cannot load such file …

brew update で、以下のエラーが出る場合の対処。

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require’: cannot load such file — mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `

cd /usr/local
git reset --hard && git clean -df

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: The /usr/local directory is not writable.

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

brew update
brew upgrade