Cyan Hall C H
Created by CyanHall.com. Last updated: 11/25/2020 👉   Homebrew is the best package manager for macOS.

1. Install Homebrew

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  

2. Disable automatically update before running brew install/upgrade/tap

    export HOMEBREW_NO_AUTO_UPDATE=1
  

3. Manage background services with macOS launchctl daemon manager

    brew services start mysql
brew services run mysql
brew services stop mysql
brew services restart mysql
brew services list # List all services managed by brew services with
brew services cleanup # Remove all unused services with
  

4. Install applications without GUI

    brew install [name]
brew uninstall [name]
brew upgrade [name]
  

5. Install applications with GUI

    brew cask install DeepL
brew cask uninstall DeepL
  

6. Install Java

    brew cask install java # latest openjdk version
brew cask install homebrew/cask-versions/zulu8 # jdk8
  

7. Install Redis

    brew install redis
brew services start redis
redis-cli
brew services stop redis
  

8. Install PostgreSQL

    brew install postgresql
brew postgresql-upgrade-database # migrate existing data
brew services start postgresql
brew services stop postgresql
  

9. Install MongoDB

    brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
brew services stop mongodb-community
# /usr/local/etc/mongod.conf
  

10. brew reinstall [email protected]

    A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/[email protected]/certs

and run
  /usr/local/opt/[email protected]/bin/c_rehash
  
[email protected] is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"
  

11. Change Homebrew origin

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

12. Reset Homebrew origin

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

13. Change Homebrew Bottles origin

    echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc