[Mac] brew update で Error: /usr/local must be writable! 対応

Pocket

brew update で Error: /usr/local must be writable! がでたときの対応方法です。

$ brew update
Error: /usr/local must be writable!

調べるとまず 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 is not writable.
 
You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami) /usr/local
 
Warning: /usr/local is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. For example, upgrading
to OS X El Capitan has been known to do this. Some versions of the
"InstantOn" component of Airfoil or running Cocktail cleanup/optimizations
are known to do this as well.
 
You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami) /usr/local
 
Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:
  brew install oniguruma
 
Run `brew missing` for more details.
 
Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.

sudo chown -R $(whoami) /usr/local しろと書かれているので、実行して brew update を再実行してみます。

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

次は update.sh: line 13: /usr/local/Library/ENV/scm/git: No such file or directory ってエラーが発生しました。

brew update
 
/usr/local/Library/Homebrew/cmd/update.sh: line 13: /usr/local/Library/ENV/scm/git: No such file or directory
()
/usr/local/Library/Homebrew/cmd/update.sh: line 13: /usr/local/Library/ENV/scm/git: No such file or directory
Error: update-report should not be called directly!
brew prune

たまに brew update すると苦労しますね・・・。

参考情報

  1. コメントはまだありません。

  1. トラックバックはまだありません。