执行brew update后显示如下:
touch: /usr/local/.git/FETCH_HEAD: Permission denied error: cannot open .git/FETCH_HEAD: Permission denied /usr/local/Library/Homebrew/cmd/update.sh: line 514: /usr/local/.git/UPDATE_FAILED: Permission denied touch: /usr/local/Library/Taps/homebrew/homebrew-nginx/.git/FETCH_HEAD: Permission denied error: cannot open .git/FETCH_HEAD: Permission denied /usr/local/Library/Homebrew/cmd/update.sh: line 514: /usr/local/.git/UPDATE_FAILED: Permission denied ==> Homebrew has enabled anonymous aggregate user behaviour analytics. Read the analytics documentation (and how to opt-out) here: http://docs.brew.sh/Analytics.html error: could not lock config file .git/config: Permission denied Error: Failure while executing: git config --local --replace-all homebrew.analyticsmessage true
解决办法:
执行以下命令即可解决问题
sudo chown -R $(whoami) /usr/local