解决 brew 慢的问题

方法一: 修改镜像源

brew update 慢 解决办法 镜像更新源

  • 中科大brew镜像源
  • 清华brew镜像源
1
2
3
4
5
6
$ 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
# 中科大镜像源
# 二者选其一即可更新
1
2
3
4
5
6
7
8
9
10
11
$ 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/

if

1
2
3
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

then

1
2
3
4
$ sudo chgrp -R admin /usr/local
# 确保目录归属管理组
$ sudo chmod -R g+w /usr/local
# 确保管理组可读

endif

方法二: 用ss

using shadowsocks in terminal