Jerry's WIKIJerry's WIKI
概述
  • 🐞 web使用
  • 📐 常用组件
  • 💡 使用技巧
  • 🎱 规范相关
  • 🖥 工作流
  • 🛠 常用工具
  • 🌐️ 服务器
  • 📦 容器相关
  • ♨️ 编程语言
咖啡屋
  • 简体中文
  • English
GitHub
概述
  • 🐞 web使用
  • 📐 常用组件
  • 💡 使用技巧
  • 🎱 规范相关
  • 🖥 工作流
  • 🛠 常用工具
  • 🌐️ 服务器
  • 📦 容器相关
  • ♨️ 编程语言
咖啡屋
  • 简体中文
  • English
GitHub
  • 🚩 版本控制(Git)

    • 秘钥的配置和使用
    • 多平台多仓库秘钥管理
    • 多人协同开发
    • 常见场景和对策
    • 其他
  • ✏️ 编辑器(Idea)

    • 快捷键修改
    • VCS操作
    • 其他
  • 🎁 调试工具

    • 压测工具
    • API测试
    • 抓包工具
  • 🔭 客户端

    • Navicat
    • Mredis
    • DockerDesktop
  • 🍎 Mac工具

    • Brew
    • Iterm2
  • 🌈 杂项

    • 列表

Brew

目录

  • 安装
  • 替换源
    • brew源
    • core源
    • cask源
    • bottles源
  • 恢复源
  • 常用命令
  • 安装旧版本PHP
    • 添加PHP旧仓库
    • 多版本切换

安装

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

替换源

【源仓库类型】

  • brew : Homebrew源代码仓库
  • homebrew-core : Homebrew核心源
  • homebrew-cask : 提供MacOS应用和大型二进制文件安装源
  • homebrew-bottles : 预编译二进制软件包

brew源

中科大
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
阿里巴巴
git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
清华大学
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

core源

中科大
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
阿里巴巴
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
清华大学
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

cask源

中科大
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
阿里巴巴
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-cask.git
清华大学
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

bottles源

你的 shell 是 zsh 就写入 zshrc ; bash 就写入 bash_profile

中科大
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/bottles' >> ~/.zshrc
阿里巴巴
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
echo 'export HOMEBREW_API_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles/api' >> ~/.zshrc
清华大学
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles' >> ~/.zshrc

最后刷新下配置

source ~/.zshrc

恢复源

git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
sed '/export HOMEBREW_BOTTLE_DOMAIN/'d ~/.zshrc
source ~/.zshrc
brew update

常用命令

# 搜索包
brew search node
# 安装最新版
brew install node
# 安装指定版本
brew install node@14.16.8
# 查看已安装的包列表
brew list
# 查看某个包的详细信息
brew info node
# 清除安装缓存
brew cleanup
# 更新brew
brew update
# 更新软件包
brew upgrade node
# 卸载软件包
brew uninstall node
# 查看brew配置
brew config
# 诊断brew
brew doctor
# 开启、关闭、重启服务
brew service start|stop|restart nginx
# 服务列表
brew services list

安装旧版本PHP

【注意】

较新版本的homebrew仓库的php版本会只有 7.4 及以上,项目需要老版本PHP会比较麻烦。


添加PHP旧仓库

brew tap shivammathur/php

此时可以搜索到不同版本的php

多版本切换

# 安装php版本切换器
brew install brew-php-switcher
# 切换版本
brew-php-switcher 8.1
编辑此页面
更新时间:
贡献者: 田朝帆
Prev
Docker Desktop
Next
Iterm2