Mac下安裝brew及wget命令支持

在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 提供的地址

  1. 替換為 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

=======================================================

  1. 還原為 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

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容