$ cd `brew --prefix`
$ git remote add origin https://github.com/Homebrew/homebrew.git
$ git fetch origin
$ git reset --hard origin/master
$ brew update
Already up-to-date.
中国镜像
cd /usr/local
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
//清华镜像源
git remote set-url origin http://mirrors.ustc.edu.cn/homebrew.git
//中科大镜像源
//二者选其一即可更新
cd ~
mkdir tmp
cd tmp
//以下要与你选择的镜像源相同
git clone git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
git clone http://mirrors.ustc.edu.cn/homebrew.git
sudo rm -rf /usr/local/.git
sudo rm -rf /usr/local/Library
sudo cp -R homebrew/.git /usr/local/
sudo cp -R homebrew/Library /usr/local/
PS:遇见的问题
╰─➤ brew update
Stashing your changes:
M .gitignore
M .yardopts
M README.md
M share/doc/homebrew/Acceptable-Formulae.md
M share/doc/homebrew/Common-Issues.md
M share/doc/homebrew/FAQ.md
M share/doc/homebrew/Formula-Cookbook.md
M share/doc/homebrew/Homebrew-0.9.3.md
M share/doc/homebrew/How-To-Open-a-Homebrew-Pull-Request-(and-get-it-merged).md
D share/doc/homebrew/How-to-Create-and-Maintain-a-Tap.md
M share/doc/homebrew/How-to-build-software-outside-Homebrew-with-Homebrew-keg-only-dependencies.md
M share/doc/homebrew/Installation.md
M share/doc/homebrew/Interesting-Taps-&-Branches.md
M share/doc/homebrew/Maintainer-Guidelines.md
M share/doc/homebrew/Press.md
M share/doc/homebrew/Python-for-Formula-Authors.md
M share/doc/homebrew/Querying-Brew.md
M share/doc/homebrew/README.md
D share/doc/homebrew/Rename-A-Formula.md
M share/doc/homebrew/Troubleshooting.md
M share/doc/homebrew/Xcode.md
M share/doc/homebrew/brew-tap.md
M share/man/man1/brew.1
fatal: Unable to create '/usr/local/.git/index.lock': Permission denied
Cannot save the current index state
Error: Failure while executing: git stash save --include-untracked --quiet
解决办法
sudo chgrp -R admin /usr/local
//确保目录归属管理组
sudo chmod -R g+w /usr/local
//确保管理组可读