banner
leoking

leoking

前端开发者
tg_channel

Install Homebrew on Mac

Installation#

If you are installing for the first time and need to change the source

The script defaults to the USTC mirror. If you need to change the source, please use the assistant to get the installation script:

# 1. Execute the installation script
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. Set up after installation
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zprofile
source ~/.zprofile

Change Source#

If you have already installed and need to change the source

After selecting "Mirror", "Platform", and "Terminal Type", the corresponding mirror setting script will be generated.

# Script
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)"

Configure Environment Variables#

Set Python environment variables

PATH="/Library/Frameworks/Python.framework/Versions/3.11/bin:${PATH}"
export PATH
alias python="/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"

Warning: The Ruby version of the Homebrew installation script has been deprecated, and the new script is rewritten in Bash.
Please use the following command:
  /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
==> Installation prompt
If you want to change the source, you can use the mirror assistant: https://brew.idayer.com/guide/change-source/

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.