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