在Mac上下載安裝homebrew
homebrew(一種類似于Linux下yum的命令)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
如果報(bào)錯(cuò)443端口權(quán)限之類無(wú)法訪問(wèn)raw.githubusercontent.com,可以配置host
199.232.68.133 raw.githubusercontent.com
驗(yàn)證是否安裝成功:brew help
安裝wget命令:brew install wget
brew安裝Redis
brew install redis // brew安裝Redis
brew services start redis // brew啟動(dòng)Redis(停止用stop)
ps axu | grep redis // 查看Redis啟動(dòng)情況
redis-cli -h 127.0.0.1 -p 6379 // 客戶端連接
redis-cli shutdown // 客戶端關(guān)閉
使用 Alibaba 的 Homebrew 鏡像源進(jìn)行加速
平時(shí)我們執(zhí)行 brew 命令安裝軟件的時(shí)候锤悄,跟以下 3 個(gè)倉(cāng)庫(kù)地址有關(guān):
brew.git
homebrew-core.git
homebrew-bottles
通過(guò)以下操作將這 3 個(gè)倉(cāng)庫(kù)地址全部替換為 Alibaba 提供的地址
- 替換為 Alibaba 倉(cāng)庫(kù)地址
替換成阿里巴巴的 brew.git 倉(cāng)庫(kù)地址:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
替換成阿里巴巴的 homebrew-core.git 倉(cāng)庫(kù)地址:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
替換 homebrew-bottles 訪問(wèn) URL:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
其他可選倉(cāng)庫(kù)
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
brew update
=======================================================
- 還原為 homebrew 倉(cāng)庫(kù)地址
還原為官方提供的 brew.git 倉(cāng)庫(kù)地址
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
還原為官方提供的 homebrew-core.git 倉(cāng)庫(kù)地址
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
還原為官方提供的 homebrew-bottles
訪問(wèn)地址 vi ~/.bash_profile
然后碟绑,刪除 HOMEBREW_BOTTLE_DOMAIN 這一行配置
source ~/.bash_profile