This is the 25th day of my participation in the August Challenge

Homebrew is a software package management tool on Mac OSX. It can easily install or uninstall software on Mac, which is equivalent to apt-get and YUM in Linux. Homebre can install UNIX tools on Mac that OS X doesn’t have. Homebrew installs them all in /usr/local/cellar and creates symbolic links in /usr/local/bin. Brew. sh/index_zh-cn…

The installation

Run the following command from the terminal

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy the code
  • After the installation is complete, you need to runbrew doctorCommand check whether there is any conflict, if so can be handled as prompted
  • After Homebrew is successfully installed, a directory is automatically created/usr/local/CellarTo store the Homebrew installation

The basic use

# search package
brew search mysql

# the installation package
brew install mysql

Check package information, such as the current version, dependencies, post-installation considerations, etc
brew info mysql

# uninstall packages
brew uninstall wget

# display installed packages
brew list

# Check brew helpThe brew -help

Update, which updates Homebrew itself
brew update

# Check out of date (new version available), this will list all installed packages which can be upgraded
brew outdated
brew outdated mysql

# Upgrade all software that can be upgraded
brew upgrade
brew upgrade mysql

Clean up unneeded versions and installation package caches
brew cleanup
brew cleanup mysql
Copy the code

Configure the mirror

Use the image of tsinghua mirror site

Configuring Index Mirroring

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-fonts.git
# git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask-drivers.git

Test whether the work is normal after replacement
brew update
Copy the code

Restoring an index mirror

git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
# git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
# git -C "$(brew --repo homebrew/cask-fonts)" remote set-url origin https://github.com/Homebrew/homebrew-cask-fonts.git
# git -C "$(brew --repo homebrew/cask-drivers)" remote set-url origin https://github.com/Homebrew/homebrew-cask-drivers.git

Test whether the work is normal after replacement
brew update
Copy the code

Configure binary precompiled package mirroring

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
Copy the code