MAC电脑安装brew

安装

首先打开brew.sh网站,把首页一条命令复制到终端里,执行,输入电脑登录密码,开始下载安装

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

换源

安装完后,因为国内网络的原因,需要更换一些快一点的源
我一直比较倾向于阿里的东西,虽然我也不知道哪个更好~~
以下为阿里源

替换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

刷新源
brew update

以下为清华源

替换brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

替换homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

刷新源
brew update

以下为腾讯源

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

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

刷新源
brew update

重置源

OK 了,如果需要出国使用,则需要把源重置回官方,代码如下

重置brew.git
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

重置homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
cd
刷新源
brew update

bottles部分需要修改配置文件
vim ~/.zshrc
找到export HOMEBREW_。。。两行字母,在行首字符加#,把两行字母注释掉就OK 了

Homebrew能干什么?

使用 Homebrew 安装 Apple(或您的 Linux 系统)没有预装但 你需要的东西。
个人觉得和centos系统上的yum&dnf很像,命令为 brew install XXX,快去试试吧。

posted @ 2021-03-04 20:29  WinyHan  阅读(350)  评论(0编辑  收藏  举报