Article directory
Problem Description
The full name of brew is Homebrew, which is a software package management tool on Mac OSX.
If you want to install it on a mac terminal, run the instructions provided online.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Encountered a 443 error
The reason is simple, because you can't open raw.githubusercontent.com at all!
As for why it can't be opened, as the saying goes, life is a wall, and people inside the wall want to get out... (I'm going too far)
Solution
We can only seek the mirror source. There are two methods:
- Install it yourself using a mirror source
- Fully automatic script packaged by others
As aseniorprogrammer (fake), of course I choose 1
method one
Run the mirror source of USTC
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"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
/bin/bash -c "$(curl -fsSL https://mirrors.ustc.edu.cn/misc/brew-install.sh)"
After waiting for a while, the installation is successful. Then, you need to execute the following two pieces of code according to the prompts:
- Add path locally
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/这里是你的mac用户名/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
- Add Git remote mirror source to avoid "encountering a wall around the corner" during the brew install process
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/这里是你的mac用户名/.zprofile
echo 'export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"' >> /Users/这里是你的mac用户名/.zprofile
echo 'export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"' >> /Users/这里是你的mac用户名/.zprofile
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"
Then run brew help
, if the following prompt pops up, the installation is successful
Example usage:
brew search TEXT|/REGEX/
brew info [FORMULA|CASK...]
brew install FORMULA|CASK...
brew update
brew upgrade [FORMULA|CASK...]
brew uninstall FORMULA|CASK...
brew list [FORMULA|CASK...]
Troubleshooting:
brew config
brew doctor
brew install --verbose --debug FORMULA|CASK
Contributing:
brew create URL [--no-fetch]
brew edit [FORMULA|CASK...]
Further help:
brew commands
brew help [COMMAND]
man brew
https://docs.brew.sh
Method Two
This way is relatively simple, just run the script directly
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Then just follow the prompts
If you don’t know how, you can refer to: Install brew on Mac (the latest tutorial, absolutely feasible, it can be done with one line of code, no Report an error)