安装#
如果你是初次安装,并且需要换其他源
脚本默认内置中科大镜像,如果需要换源,请使用小助手获取安装脚本:
# 1.执行安装脚本
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"
# 2.安装完成后设置
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
source ~/.zprofile
换源#
如果你已经安装过,需要换源
选择 "镜像"、"平台"、"终端类型" 后,会自动生成对应的设置镜像脚本。
# 脚本
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
brew update
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
source ~/.zprofile
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
配置环境变量#
设置 Python 环境变量
PATH="/Library/Frameworks/Python.framework/Versions/3.11/bin:${PATH}"
export PATH
alias python="/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"
Warning: Ruby版本Homebrew安装脚本已被废弃,新版脚本使用Bash重写。
请使用以下命令:
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"
==> Checking for `sudo` access (which may request your password).
Password:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> 安装提示
如果你想换源,可以使用镜像助手:https://brew.idayer.com/guide/change-source/