Created by CyanHall.com on 11/10/2020 , Last updated: 04/30/2021.
πŸ‘‰Β Β github shields Star me if it’s helpful.
Homebrew is the best package manager for macOS.

1. Install Homebrew

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

# for x86_64
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
alias ibrew="arch -x86_64 /usr/local/bin/brew" # save in .zshrc
ibrew install [email protected]
  

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. Uninstall any applications using Homebrew

    # include third party application installed not using Homebrew.
brew uninstall --cask --force --zap pycharm
# --zap will delete relative files, can be checked with: brew cat
  

7. Install Java

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

8. Install Redis

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

9. Install PostgreSQL

    brew install postgresql
brew postgresql-upgrade-database # migrate existing data
brew services start postgresql
brew services stop postgresql
# /opt/homebrew/opt/postgresql/bin/postgres -D /opt/homebrew/var/postgres
# // echo 'export PATH="/opt/homebrew/opt/postgresql@13/bin:$PATH"' >> ~/.zshrc
# export LDFLAGS="-L/opt/homebrew/opt/postgresql@13/lib"
# export CPPFLAGS="-I/opt/homebrew/opt/postgresql@13/include"
  

10. Install MySQL

    brew install mysql
brew services start mysql
brew services stop mysql
# /opt/homebrew/opt/mysql/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql
# sudo /opt/homebrew/Cellar/mysql/8.0.28/bin/mysql.server start
  

11. 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
  

12. 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"
  

13. 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
  

14. 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
  

15. Change Homebrew Bottles origin

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

1. Install Homebrew

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

# for x86_64
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
alias ibrew="arch -x86_64 /usr/local/bin/brew" # save in .zshrc
ibrew install [email protected]
  

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
  

5. Install applications with GUI

    brew cask install DeepL
brew cask uninstall DeepL
  

7. Install Java

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

9. Install PostgreSQL

    brew install postgresql
brew postgresql-upgrade-database # migrate existing data
brew services start postgresql
brew services stop postgresql
# /opt/homebrew/opt/postgresql/bin/postgres -D /opt/homebrew/var/postgres
# // echo 'export PATH="/opt/homebrew/opt/postgresql@13/bin:$PATH"' >> ~/.zshrc
# export LDFLAGS="-L/opt/homebrew/opt/postgresql@13/lib"
# export CPPFLAGS="-I/opt/homebrew/opt/postgresql@13/include"
  

11. 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
  

13. 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
  

15. Change Homebrew Bottles origin

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

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

    export HOMEBREW_NO_AUTO_UPDATE=1
  

4. Install applications without GUI

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

6. Uninstall any applications using Homebrew

    # include third party application installed not using Homebrew.
brew uninstall --cask --force --zap pycharm
# --zap will delete relative files, can be checked with: brew cat
  

8. Install Redis

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

10. Install MySQL

    brew install mysql
brew services start mysql
brew services stop mysql
# /opt/homebrew/opt/mysql/bin/mysqld_safe --datadir=/opt/homebrew/var/mysql
# sudo /opt/homebrew/Cellar/mysql/8.0.28/bin/mysql.server start
  

12. 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"
  

14. 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
  


Maitained byΒ Cyanhall.com, Copy Rights @ CC BY-NC-SA 4.0 Β  Β  ExcelRoadMap