Updating Homebrew...

==> Using the sandbox

==> Downloading https://ftpmirror.gnu.org/emacs/emacs-25.1.tar.xz

==> Downloading from http://mirrors.ustc.edu.cn/gnu/emacs/emacs-25.1.tar.xz

######################################################################## 100.0%

==> ./configure --disable-silent-rules --enable-locallisppath=/usr/local/share/e

==> make

==> make install

==> Caveats

Please try the Cask for a better-supported Cocoa version:

  brew cask install emacs


To have launchd start emacs now and restart at login:

  brew services start emacs

Or, if you don't want/need a background service you can just run:

  emacs

==> Summary

  /usr/local/Cellar/emacs/25.1: 4,046 files, 118.6M, built in 3 minutes 26 seconds

我升级系统到macOS sierra 后,用如下命令更新了homebrew

cd "$(brew —repo)" && git fetch && git reset —hard origin/master && brew update

遇到错误:

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

按照提示设置了,成功执行了brew update

然后在升级go的时候又遇到权限问题了,描述如下

Error: Running Homebrew as root is extremely dangerous. As Homebrew does not
drop privileges on installation you are giving all build scripts full access
to your system. As a result of the macOS sandbox not handling the root user
correctly HOMEBREW_NO_SANDBOX has been set so the sandbox will not be used. If
we have not merged a pull request to add privilege dropping by November 1st
2016 running Homebrew as root will be disabled. No Homebrew maintainers plan
to work on this functionality.
Error: Cowardly refusing to 'sudo brew install'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

这个错误的解决办法就是把它提示你的目录都删掉。然后重新安装一次brew或者brew update一下。