Mac下安装brew及wget命令支持

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

  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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。