Homebrew is a package management tool for MacOS, similar to Ubuntu’s apt and Arch Linux’s pacman, with many useful functions such as install, uninstall, update, view, search, etc. Many useful functions. It is very convenient and quick to implement package management with a simple command, without you caring about various dependencies and file paths.
Installation and use of Homebrew
Homebrew installation
Homebrew is installed by simply typing a command in the command line. The specific command is available at official website.
|
|
Homebrew Usage
|
|
Homebrew configuration
Homebrew consists of four main parts: brew, homebrew-core, homebrew-cask, homebrew-bottles, which correspond to the following functions.
- homebrew: source code repository
- homebrew-core: Homebrew core source
- homebrew-cask: provides installation of macos applications and large binaries
- homebrew-bottles: pre-compiled binary packages
Homebrew’s default software source is not in China, so if you are a Chinese user, the download speed is very slow when installing.
You can modify the software source like other package management tools.
View current source
Switching software sources
Mac OS started in 10.15 system, the default shell are changed to zsh, so here only introduce the method of terminal as zsh. Take CSTD source as an example.
|
|
Other sources.
- Ali cloud: https://mirrors.aliyun.com/homebrew/brew.git
- Tencent Cloud: https://mirrors.cloud.tencent.com/homebrew/brew.git
- Tsinghua: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
- Beijing Foreign Studies University: https://mirrors.bfsu.edu.cn/git/homebrew/brew.git
Restore the default source
|
|
The homebrew-bottles configuration can only be deleted manually by removing the HOMEBREW_BOTTLE_DOMAIN=https://mirrors.xxx.com
content from the ~/.zprofile
file and executing source ~/.zprofile
.
other content
Currently cask is reading software sources from GitHub, and GitHub Api has restrictions on access, so if you use it more frequently, you can request an Api Token and then configure it to HOMEBREW_GITHUB_API_TOKEN in the environment variable.
Append to the .zprofile
, taking care to replace yourtoken: