赞
踩
下文中所有命令,均在
2.5.6-132-gde8f487
版本验证通过。
Homebrew
是一款包管理工具,目前支持macOS
和linux
系统。主要有四个部分组成: brew
、homebrew-core
、homebrew-cask
、homebrew-bottles
。
名称 | 说明 |
---|---|
brew | Homebrew 源代码仓库 |
homebrew-core | Homebrew 核心源 |
homebrew-cask | 提供 macOS 应用和大型二进制文件的安装 |
homebrew-bottles | 预编译二进制软件包 |
# 安装
/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/master/uninstall)"
# 自升级
brew upgrade brew
第一步,替换brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
第二步:替换homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换homebrew-cask默认源
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-cask.git
替换homebrew-bottle默认源
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
附清华大学源:
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
命令 | 说明 |
---|---|
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 start|stop|restart 软件名 | 启动/停止/重启Homebrew服务 |
默认安装路径:/usr/local/Cellar/
如需修改,则修改config
中的HOMEBREW_PREFIX
参数(默认为/usr/local
)。个人建议不要修改,因为凡自己安装的软件大部分都放在这个目录下,保证安装路径统一。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。