一、Homebrew介绍
Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。
二、安装homebrew
1、命令行
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2、解决报错的问题:
问题:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
解决方案:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
3、使用官网命令安装 https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
记得更新环境变量 .zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
三、Homebrew的卸载
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/HomebrewUninstall.sh)"
四、Homebrew的使用
1.查看Homebrew命令:
brew help
2.安装任意包:
brew install <packageName>,eg:brew install node
3.卸载任意包:
brew uninstall <packageName>,eg:brew uninstall git
4.查询可用包:
brew search <packageName>
5.查询已安装包列表:
brew list
6.查看任意包信息:
brew info <packageName>
7.更新Homebrew:
brew update
8.Homebrew帮助信息:
brew -h
8.查看brew版本:
brew -v
10.整理重复语句:
open ~/.zshrc -e、open ~/.bash_profile -e
四、问题参考
1、Mac 错误 zsh: command not found: brew解决方法
2、清华大学开源软件镜像站
3、Mac安装Homebrew的正确姿势