Original https://www.cnblogs.com/kccdzz/p/7676840.html
Here is a backup so that I can find it myself.
1 Introduction
brew is a package management tool, similar to yum under centos or apt-get under ubuntu, very convenient, eliminating the inconvenience of manual compilation and installation
brew installation directory /usr/local/Cellar
brew configuration directory /usr/local/etc
brew command directory /usr/local/bin Note: homebrew automatically adds a soft link to /usr/local/bin after installation, so this path is usually used
2. Installation and basic use
Installation method: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Common commands:
brew update #Update the brew installable package, it is recommended to execute it every time
brew search php55 #Search php5.5
brew tap josegonzalez/php #Install the extension <gihhub_user/repo> to get more resources
brew tap #View the list of installed extensions
brew install php55 #install php5.5
brew remove php55 #uninstall php5.5
brew upgrade php55 #Upgrade php5.5
brew options php55 #View php5.5 installation options
brew info php55 #View php5.5 related information
brew home php55 #Visit the official website of php5.5
brew services list #View the services installed by the system through brew
brew services cleanup #Clear uninstalled useless startup configuration files
brew services restart php55 #restart php-fpm
3. Replace the homebrew mirror source (choose by yourself)
Since a lot of things on homebrew are either blocked or slow, you need to change the brew source (divided into two parts)
Replace homebrew default sources
cd "$(brew --repo)" //This command will enter the corresponding directory, which can be viewed by pwd
cd "$(brew --repo)" git remote set-url origin git://mirrors.ustc.edu.cn/brew.git
Homebrew Bottles source (binary code package)
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
renew
brew update