Mac 三分钟安装Homebrew

1.简单介绍

macOS(或 Linux)缺失的软件包的管理器

2.如何安装

step1:安装homebrew

curl -fsSLO https://raw.githubusercontent.com/Homebrew/install/master/install.sh

step2:换brew源1

#编辑install.sh
vim install.sh

#替换install.sh 中 BREW_REPO 源 
BREW_REPO="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"

step3:安装Homebrew

#执行install.sh脚本
sh ./install.sh

#执行到安装Homebrew-core,Ctrl+C
mkdir -p "$(brew --repo homebrew/core)" && git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git "$(brew --repo homebrew/core)"

mkdir -p "$(brew --repo homebrew/cask)" && git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git "$(brew --repo homebrew/cask)"

mkdir -p "$(brew --repo homebrew/cask-fonts)" && git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git "$(brew --repo homebrew/cask-fonts)"

mkdir -p "$(brew --repo homebrew/cask-drivers)" && git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git "$(brew --repo homebrew/cask-drivers)"

#执行更新
brew update

3.如何卸载

#执行删除脚本
sudo /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

#得到以下提示
The following possible Homebrew files were not deleted:
/usr/local/Frameworks/
/usr/local/Homebrew/
/usr/local/bin/
/usr/local/etc/
/usr/local/include/
/usr/local/lib/
/usr/local/opt/
/usr/local/sbin/
/usr/local/share/
/usr/local/var/

#删除相关Homebrew文件
sudo rm -rf /usr/local/Homebrew /usr/local/var/homebrew

4.brew 安装应用

#牛刀小试
#1.查找应用 微信
brew cask info wechat
#2.安装应用 微信
brew cask install wechat
#3.卸载应用 微信
brew cask uninstall wechat

5.遇到的问题

1.raw.githubusercontent.com | api.github.com 连接拒绝

问题描述:

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
curl: (7) Failed to connect to api.github.com port 443: Connection refused

解决方案:/etc/hosts 追加 raw.githubusercontent.com、api.github.com

#在 https://www.ipaddress.com/ 上查找 raw.githubusercontent.com、api.github.com 对应的Ipv4地址.
sudo vim /etc/hosts

#/etc/hosts 内容里追加以下内容,地址根据ipaddress查的结果配置。
199.232.68.133 raw.githubusercontent.com
140.82.114.3 api.github.com

#确认 raw.githubusercontent.com、 github.com可以访问
ping raw.githubusercontent.com
ping api.github.com

6.附件

提供install_brew.sh修改后附件
链接: https://pan.baidu.com/s/1sDExiZzNL6kxuSmDal-xag 提取码: ecbk


  1. 清华大学开源软件镜像站 ↩︎

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值