HomeBrew Installation and Source Change Tutorial on Mac
Mac Mac OS system from the Unix system, thanks to this Mac system is similar to the use of Linux, so the concept of package management in the Linux system is also applicable to the Mac, and HomeBrew is one of the excellent package management tools, and what is a package management tool? Package management tools, with installation, uninstallation, update, view, search and other functions, in the terminal through a simple command can realize all kinds of functionality package management, without having to care about a variety of dependencies and file paths. So no matter what driver? Development tools? can be quickly downloaded in HomeBrew without the complicated environment management like Win.
Installation Tutorial
To quickly check for HomeBrew on your computer you only need one line of command
brew -v #Check if HomeBrew exists on your computer
If the terminal prints the version information, it proves that HomeBrew exists in the computer, if it prints unknown commands, it means that there is no HomeBrew environment in the computer.
Similar to FishSense ROS in Robotics, which installs the required environment with a single click, HomeBrew also provides a one-click installation script for users to install with a single click:
- If you need to reinstall please uninstall HomeBrew first:
/bin/bash -c "$(curl -fsSL /Homebrew/install/HEAD/)"
- Commands for one-click installation (may require Science On The Net):
/bin/bash -c "$(curl -fsSL /Homebrew/install/HEAD/)"
If you encounter this error: curl: (7) Failed to connect to port 443: Connection refused on behalf of the network can not access the need for Science On The Net, generally speaking XXX network after the installation and download speed is very fast!
Attached are commonly used HomeBrew commands
- To find HomeBrew's user help screen enter
brew -h
brew help
- Check out the version of HomeBrew
brew -v
- Updating HomeBrew
brew update
HomeBrew change source command
HomeBrew default source in foreign countries, usually normal use is very slow so we can replace it with a domestic source
- View Current Source
cd "$(brew --repo)" && git remote -v
Replace with Tsinghua Source
# Replacement of individual sources
$ git -C "$(brew --repo)" remote set-url origin /git/homebrew/
$ git -C "$(brew --repo homebrew/core)" remote set-url origin /git/homebrew/
$ git -C "$(brew --repo homebrew/cask)" remote set-url origin /git/homebrew/
# zsh interchangeability brew bintray mirroring
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# bash interchangeability brew bintray mirroring
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# refresh source
$ brew update
Replace with CKDY
# Replacement of individual sources
$ git -C "$(brew --repo)" remote set-url origin /
$ git -C "$(brew --repo homebrew/core)" remote set-url origin /
$ git -C "$(brew --repo homebrew/cask)" remote set-url origin /
# zsh interchangeability brew bintray mirroring
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# bash interchangeability brew bintray mirroring
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# refresh source
$ brew update