Homebrew是一款Mac OS平台下的软件包管理工具,拥有安装、卸载、更新、查看、搜索等很多实用的功能。简单的一条指令,就可以实现包管理,而不用你关心各种依赖和文件路径的情况,十分方便快捷。
$ /bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"
$ /bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/uninstall.sh)"
$ cd /usr/local/Homebrew/Library/Taps/homebrew/
$ rm -rf homebrew-core
$ git clone https://github.com/Homebrew/homebrew-core.git
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
安装报错这个,试试连接梯子:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection reset by peer
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
卸载过程中根据提示进行操作
dengzemiaodeMacBook-Pro:~ dengzemiao$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"
Warning: This script will remove:
/Users/dengzemiao/Library/Caches/Homebrew/
/usr/local/Caskroom/
/usr/local/Cellar/
/usr/local/bin/brew -> /usr/local/bin/brew
Are you sure you want to uninstall Homebrew? This will remove your installed packages! [y/N]
......
$ brew install 包名
示例:
$ brew install node
$ brew uninstall 包名
示例:
$ brew uninstall node
$ brew search 包名
# 更新全部包
$ brew upgrade
# 更新指定包
$ brew upgrade 包名
$ brew list
$ brew info 包名
# 查看哪些软件包要被清除
$ brew cleanup -n
# 清除指定软件包的所有老版本
$ brew cleanup 软件名
# 清除所有软件包的所有老版本
$ brew cleanup
$ brew -v
$ brew update
$ brew -h
$ sudo brew update
dengzemiaodeMacBook-Pro:~ dengzemiao$ brew search nginx
Warning: Error searching on GitHub: GitHub Bad credentials:The GitHub credentials in the macOS keychain may be invalid.
Clear them with:
printf "protocol=https\nhost=github.com\n" | git credential-osxkeychain erase
Or create a personal access token:
https://github.com/settings/tokens/new?scopes=gist,public_repo&description=Homebrew
echo 'export HOMEBREW_GITHUB_API_TOKEN=your_token_here' >> ~/.bash_profile
==> Formulae
nginx
解决方式:
https://github.com/settings/tokens/new?scopes=gist,public_repo&description=Homebrew
2、打开命令行,输入下面命令,回车之后就行了,然后就正常使用:
$ export HOMEBREW_GITHUB_API_TOKEN=填入你刚才得到的Token
例如:
$ export HOMEBREW_GITHUB_API_TOKEN=465832bc2dd057a2c556f...