王尘宇王尘宇

研究百度干SEO做推广变成一个被互联网搞的人

macOS安装brew教程


当你安装完macOS系统后,为了方便后续使用命令行安装软件,这时候你需要配置好brew包管理工具的环境。

那么这里来说明下如何配置安装吧。

1. github地址下载

由于一键下载shell脚本使用的raw.githubusercontent.com地址无法直接访问,所以我这里不使用这种方法。

下面教大家另外一个方法:

访问这个地址https://github.com/Homebrew/install/blob/master/install.sh进入代码页面,拷贝shell脚本的内容,保存到本地的install.sh

2. 修改shell脚本的资源链接,替换成中国镜像

把shell脚本这句

BREW_REPO="https://github.com/Homebrew/brew"

更改为

BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"

3.执行脚本

$ sh  install.sh

过程中,你输入输入密码,接着会要求输入一次回车,接着你会遇到这个卡住的日志:

==>Homebrewisrun entirelybyunpaid volunteers. Please consider donating:https://github.com/Homebrew/brewdonations==>Tapping homebrew/coreCloning into/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...

按住ctrl+c断开,我们来解决这个问题。

虽然我们已经安装brew命令成功了,但是要安装homebrew-core由于git地址的原因,我们需要执行以下命令来更换git源地址。

$cd"$(brew --repo)"$git remoteset-url origin https://mirrors.ustc.edu.cn/brew.git$cd"$(brew --repo)/Library/Taps/"$mkdir homebrew &&cdhomebrew$gitclonehttps://mirrors.ustc.edu.cn/homebrew-core.git

4.再次执行脚本

$ sh  install.sh

过程中,你输入输入密码,接着会要求输入一次回车,然后看到顺利执行完成。

==>Installation successful!

5.更新

$ brewupdateAlready up-to-date.

6.安装软件

这里以wget命令为例。

$ brew install wget

你学会了吗?希望对需要安装这个软件的你,有所帮助。

相关文章

评论列表

发表评论:
验证码

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。