MacOS安装brew教程从入门到入土

1.打开macos的终端,输入 

/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"

2.等待安装完成后的提示

提示需要执行一个命令将homebrew添加到path中,复制提示文本继续在终端中执行,注意,这里每个人的电脑名字不一样,一定要复制你自己终端里提示的命令,我的只是一个参考,直接复制全部就行,不需要换行和调整格式什么的

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/zyyt/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"

  3.此时再执行brew help就可以看到相关信息提示已经有brew了

4.把brew下载包的地址切换为国内的镜像地址,和切换npm的下载地址为淘宝镜的意思一样

依次执行以下4条命令 

git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
 
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
 
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
 
brew update

5.设置bottles镜像 

继续执行以下命令

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
source ~/.zprofile

以上,完成了homebrew的所有配置,可以使用homebrew来安装你想要的包了

brew install 某某包名称

猜你喜欢

转载自blog.csdn.net/MrWangisgoodboy/article/details/127609389