安裝#
如果您是首次安裝並需要更換其他來源
腳本預設內建中科大鏡像,如果需要更換來源,請使用小助手獲取安裝腳本:
# 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"
警告: Ruby版本Homebrew安裝腳本已被廢棄,新版腳本使用Bash重寫。
請使用以下命令:
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"
==> 檢查是否具有`sudo`訪問權限(可能需要輸入密碼)。
密碼:
==> 此腳本將安裝:
/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/