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