Mac安装Homebrew包管理器
Mac安装Homebrew包管理器
- 官网安装
- 非官网安装(解决安装下载慢问题)
- 解决homebrew源下载慢问题
- Homebrew 常用命令
官网安装
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
非官网安装(解决安装下载慢问题)
将官网中的install 文件下载到本地
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh >> brew_install.sh
homebrew官网
更改安装文件中源中的地址
找到下面命令
BREW_REPO = "https://github.com/Homebrew/brew".freeze
CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze
替换成清华大学镜像
BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git".freeze
执行安装命令
/bin/bash brew_install.sh
解决homebrew源下载慢问题
替换homebrew使用阿里云的源
# 替换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
替换成官方源
# 重置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 常用命令
查看homebrew版本信息
# brew -v
# 查看已安装的包列表
brew list
# 安装包
brew install 包名
# 卸载包
brew uninstall 包名
# 查找包
brew search 包名
# 查看包信息
brew info 包名
# 更新homebrew
brew update
# 诊断homebrew
brew doctor
# 查看帮助信息
brew -h
还没有评论,来说两句吧...