Skip to content

Homebrew

官网 - https://brew.sh

官方文档 - https://docs.brew.sh

清华大学镜像 - https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/

安装

bash
# ----------------------------------------------------------------------------------------------------------------------
# 安装
# ----------------------------------------------------------------------------------------------------------------------
# 清华大学
export HOMEBREW_BREW_GIT_REMOTE=https://mirrors.aliyun.com/homebrew/brew.git
export HOMEBREW_CORE_GIT_REMOTE=https://mirrors.aliyun.com/homebrew/homebrew-core.git
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles
# 阿里云
export HOMEBREW_BREW_GIT_REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
export HOMEBREW_CORE_GIT_REMOTE=https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles
# 中科大
export HOMEBREW_BREW_GIT_REMOTE=https://mirrors.ustc.edu.cn/brew.git
export HOMEBREW_CORE_GIT_REMOTE=https://mirrors.ustc.edu.cn/homebrew-core.git
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
#
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/Homebrew/install@HEAD/install.sh)"
# ----------------------------------------------------------------------------------------------------------------------
# 卸载
# ----------------------------------------------------------------------------------------------------------------------
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
/bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/Homebrew/install@HEAD/uninstall.sh)"
# ------------------------------------------------------------------------------------------------------------
# 更新
# ------------------------------------------------------------------------------------------------------------
brew outdated
brew update
brew update --verbose
brew upgrade
brew upgrade --cask $(brew list --cask)
#
brew tap homebrew/cask
brew tap homebrew/cask-drivers
brew tap homebrew/cask-fonts
brew tap homebrew/cask-versions
# 常用基础工具
brew install sevenzip
brew install openssl
brew install erlang
brew install git
brew install crypto
brew install pkg-config
brew install imagemagick
brew install vips
brew install ios-deploy
brew install ruby
brew install mysql
brew install redis
brew install rabbitmq
brew install php
brew install nginx
brew install postgresql@17
# mongodb
brew tap mongodb/brew
brew install mongodb-community
# tools
brew install zed
brew install sequel-ace
# tools - cask
brew install --cask dbeaver-community
brew install --cask warp
brew install --cask powershell
brew install --cask applite
# 基础服务
brew services start php
brew services start mysql
brew services start redis
brew services start rabbitmq
brew services start nginx
brew services start postgresql@17
brew services start mongodb-community
# 重启服务
sudo brew services restart nginx
brew services restart php
brew services restart redis
brew services restart mysql
brew services restart postgresql@17
brew services restart rabbitmq
brew services restart mongodb-community
brew services restart mongodb/brew/mongodb-community
# 列出所有服务
brew services list
# 显示安装路径
# MacOS	- /opt/homebrew
# Linux - /home/linuxbrew/.linuxbrew
brew --prefix
# 查看下载路径
brew --cache
#
brew uninstall rabbitmq
brew uninstall wget
brew uninstall node@14
brew uninstall node@16
brew uninstall node@18
brew uninstall python@3.9
brew uninstall postgresql@17