GitHub iconTwitter icon

🍺 homebrew

为解决`brew update`在国区太慢的原因。但是并不推荐这么做,因为 `Github` 加入了 `2FK`,更好的方式还是通过 `Surge` 代理网络。

替换brew.git

cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

替换homebrew-core.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

替换homebrew-bottles.git

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

替换homebrew-cask.git:

cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

`brew update --verbose`检查是否成功

还原

cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://github.com/homebrew/homebrew-cask

refs: https://www.raydbg.com/2019/Homebrew-Update-Slow/

npm package rust app

https://blog.woubuc.be/post/publishing-rust-binary-on-npm/

看 demo 例子更加实时

brew package rust app / 打包 rust 到 homebrew

https://federicoterzi.com/blog/how-to-publish-your-rust-project-on-homebrew/

rm -rf /usr/local/var/homebrew/locks
  • disable brew update `HOMEBREW_NO_AUTO_UPDATE=1 brew install <pkg>`