创建于 2020-11-10, 上次更新:2021-01-08。
👉  github shields 如果有用请点赞。
Homebrew 是 macOS 上的软件包管理器。

1. 安装 Homebrew

    /bin/bash -c "$(curl -fsSL"

2. 在运行 brew install/upgrade/tap 前跳过自动更新


3. 使用 macOS 的 launchctl 管理后台程序

    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. 安装没有图形界面的软件

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

5. 安装有图形界面的软件

    brew cask install DeepL
brew cask uninstall DeepL

6. 安装 Java

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

7. 安装 Redis

    brew install redis
brew services start redis
brew services stop redis

8. 安装 PostgreSQL

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

9. 安装 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. 修改 Homebrew 源

    cd "$(brew --repo)"
git remote set-url origin
// homebrew-core 
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin

12. 重置 Homebrew 源

    cd "$(brew --repo)"
git remote set-url origin
// homebrew-core
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin

13. 修改 Homebrew Bottles 源

    echo 'export HOMEBREW_BOTTLE_DOMAIN=' >> ~/.zshrc
source ~/.zshrc

Maitained by, Copy Rights @ CC BY-NC-SA 4.0