Homebrew国内源设置与常用命令,Updating Homebrew... 长时间不动解决方法
参考:https://segmentfault.com/a/1190000008274997
安装Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
注意:使用国内源的时候一般不连接shadowsock等VPN,不然访问可能出错
替换为中科大源
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换Homebrew Bottles
源:
就是在~/.bashrc或者~/.zshrc文件末尾加
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
如果替换源之后brew update
没反应
~/ cd "$(brew --repo)"
git pull origin master //更新homebrew
brew update
brew upgrade
命令 解释
brew install [package] 安装包
brew update 更新服务器包目录
brew uninstall 卸载包
brew upgrade 升级包
brew list -version 列出所有安装的包
brew prune 清理无效项