Introduce some advanced uses of homebrew
Homebrew general usage tutorial
Replace domestic sources
I wrote an installation script to select domestic sources during installation :
github address: https://github.com/rgf456/HomebrewInstall
Modified based on the official script:
1. Start the iterm terminal and enter the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/rgf456/HomebrewInstall/master/install.rb)"
At this time, the script will be automatically executed and output The following:
~/ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/rgf456/HomebrewInstall/master/install.rb)"
Please enter the source you want to choose
0. HomeBrew official mirror:
brew: https://github.com/Homebrew/brew
core: https://github.com/ Homebrew/homebrew-core
1. Mirror of Tsinghua University:
brew: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
core: https: //mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
2. Chinese University of Science and Technology Mirror:
brew: https://mirrors.ustc.edu.cn/brew. git
core: https://mirrors.ustc.edu.cn/homebrew-core.git
-------------Please enter 0, 1, 2 to select the source Address--------------
2. Select the corresponding source number, enter the corresponding number, you can use the corresponding source
0< br />You chose the official mirror Like
Please ignore the warning
If you enter a number other than 0, 1, and 2, you will be prompted to select the official installation by default.
3. Official Process
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local /share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr /local/Homebrew
Press RETURN to continue or any other key to abort
Click enter and wait for the installation to complete
After the installation is complete
Execute
p>
cd "$(brew --repo)"
git remote -v
You can see if the mirror address is changed:
~/ cd "$(brew --repo)"
/usr/local/Homebrew/ [stable] git remote -v
origin https://mirrors.tuna.tsinghua.edu.cn /git/homebrew/brew.git (fetch)
origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git (push)
rgf456 https://github .com/rgf456/brew (fetch)
rgf456 https://github.com/rgf456/brew (push)
If you don’t want to use my script to install, but think of yourself If specified:
The following is the official tutorial for manually replacing the Tsinghua mirror, which can be executed one by one.
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew .git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua. edu.cn/git/homebrew/homebrew-core.git
brew update
Find the cache path of homebrew
Execute the following commands
< pre>brew –cache
Generally, the path is as follows~/Library/Caches/Homebrew
Directly enter the cache path
cd (brew --cache)
At this time, you directly enter the cache directory.
The cache directory can be specified during installation: (not recommended)
First download the installation script:
https://raw.githubusercontent…
Change this script Save the content locally and name it as install
After downloading the install script, find the HOMEBREW_CACHE variable, modify it to the folder you want, and then execute the installation command:
/usr/bin/ruby -e " $(cat install)"
You can install homebrew.
Uninstall homebrew
Execute the following command
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master /uninstall)"