Homebrew安装与配置

一. Homebrew介绍

Homebrew是一款macOS(或 Linux)软件包的管理工具。主要有四个部分组成: brewhomebrew-corehomebrew-caskhomebrew-bottles

名称说明
brewHomebrew 源代码仓库
homebrew-coreHomebrew 核心源
homebrew-cask提供 macOS 应用和大型二进制文件的安装
homebrew-bottles预编译二进制软件包

二. 安装Homebrew

# 安装
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 卸载
/bin/bash -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall)"
# 自升级
brew upgrade brew

三. 更换镜像

分别替换brewhomebrew-corehomebrew-caskhomebrew-bottles

cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

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

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew-cask.git

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

四. Brew命令

软件默认安装路径:/usr/local/Cellar/

命令说明
brew help查看帮助
brew search 软件名搜索软件
brew info 软件名查询指定软件信息
brew install 软件名安装软件
brew install 软件名@版本号安装指定版本的软件(安装前可先search有哪些版本)
brew outdated检查哪些软件可更新
brew update升级所有软件
brew upgrade 软件名升级指定软件
brew uninstall 软件名卸载软件
brew cleanup清除所有软件的旧版本
brew cleanup 软件名清除指定软件的旧版本
brew cleanup -n查看可清理的旧版本的软件,不做实际清除操作
brew pin 软件名锁定指定软件,保证在全局更新时不更新
brew unpin 软件名取消锁定指定软件
brew list查询已安装的软件信息
brew deps --installed --tree查看已安装软件的依赖,以树形展示
brew config查看Homebrew配置
brew services startstop

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值