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