Homebrew domestic source Settings with common commands

Time:2019-10-24

Homebrew

Execute the following statement on the terminal to installHomebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrew installs all these tools into the /usr/local/cellar directory and creates symbolic links in /usr/local/bin

Installation may be a bit slow

The brew source

Note: when using domestic sources, do not connect shadowsock and other VPN, otherwise access may be wrong

Sometimes the resources you need to install are on GitHub or s3 and download slowly, plus this one USES shadowsocks

export ALL_PROXY=socks5://127.0.0.1:portnumber

At present, the previous article has expired, the latest macOS to close SIP, not recommended
Such as the installationmpvwhen

brew install --HEAD --with-bluray-support --with-libdvdread --with-little-cms2 --with-lua --with-bundle mpv

1. Replace with University of Science and Technology of China source

replacebrew.git

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

replacehomebrew-core.git:

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

replaceHomebrew BottlesSource:
Is in the~/.bashrcor~/.zshrcAdd to end of file

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles

You can create these two files yourself,~/.bashrcand~/.bash_profileCan be

2. Switch back to official source:
resetbrew.git

cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

resethomebrew-core

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git

3. Replace with tsinghua source:
The brew tsinghua source

If you replace the sourcebrew updateHave no reaction

First checkvpnWhether to hang up and thencdtoHomebrewThe warehouse of

~/ CD usr/local/Homebrew // or
~/ cd "$(brew --repo)"
Git pull origin master // update homebrew
brew update
already up-to-date
brew upgrade

The commonly usedbrewCommand:

The command explain
brew install [package] The installation package
brew update Update the server package directory
brew uninstall Uninstall packages
brew upgrade Upgrade package
brew list -version List all installed packages
brew prune Clean up invalid item