Mac 安装 HomeBrew

HomeBrew 官网安装

安装命令

bash 复制代码
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

卸载命令

bash 复制代码
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

清华大学镜像加速安装

清华大学 Homebrew 镜像文档地址

https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/

配置镜像环境变量

bash 复制代码
export HOMEBREW_INSTALL_FROM_API=1
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"

下载安装脚本

bash 复制代码
git clone --depth=1 https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/install.git ~/brew-install

运行安装脚本

bash 复制代码
/bin/bash ~/brew-install/install.sh

安装之后还需要将镜像地址写入环境变量配置文件 ~/.zprofile, 以便后续升级 brew

sh 复制代码
eval "$(/usr/local/bin/brew shellenv)"

# Set PATH, MANPATH, etc., for Homebrew.
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
相关推荐
尽兴-3 天前
Mac「brew」快速安装Redis
数据库·redis·macos·brew
尽兴-3 天前
Mac 「brew」快速安装MySQL
mysql·macos·adb·brew
布尼卡4 天前
mac brew 无法找到php7.2 如何安装php7.2
php·mac
Andy3227 天前
030 期 3个神器让你的Mac更聪明!
ios·github·mac
HiF8 天前
新的生产力工具——MacBook Pro
mac
Nu118 天前
解决 mbp14/16 的 miniled 屏幕刺眼发黄问题
操作系统·mac
110109 天前
AppKit(一):NSAppliaction类
mac
差不多程序员9 天前
工作纪实_63-Mac电脑使用brew安装软件
kafka·mac·brew
Piper蛋窝10 天前
如何在 Mac M1 Pro 上 debug Linux Kernel | 基于 Ubuntu 24 工具链和 QEMU
linux·mac
独隅14 天前
在 macOS 上设置来电自启动
macos·mac