在Mac上下载安装homebrew
homebrew(一种类似于Linux下yum的命令)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
如果报错443端口权限之类无法访问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 // 客户端关闭
使用 Alibaba 的 Homebrew 镜像源进行加速
平时我们执行 brew 命令安装软件的时候,跟以下 3 个仓库地址有关:
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