首先,可以按照官方(http://brew.sh/index_zh-cn.html)的命令去安装
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
但关于在install brew时,可能会遇到如下问题
error: unable to unlink old '.github/CONTRIBUTING.md' (Permission denied)
error: unable to unlink old '.github/ISSUE_TEMPLATE.md' (Permission denied)
error: unable to unlink old '.github/PULL_REQUEST_TEMPLATE.md' (Permission denied)
error: unable to create symlink Library/ENV/3.2.6 (Permission denied)
error: unable to create symlink Library/ENV/4.2 (Permission denied)
fatal: cannot create directory at 'Library/ENV/4.3': Permission denied
Failed during: git reset --hard origin/master
此时可以先uninstall brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
然后
sudo chown -R $(whoami) /usr/local
这时候就可以用上一开始提及到的那个安装命令了