Mac下Homebrew的安装与使用(安装指定版本的软件)

Homebrew是一个macOS软件包管理器

它的介绍和安装方法其实在官网首页上都有:
https://brew.sh/index_zh-cn.html

注:如果被墙的自己想办法咯,如果执行brew install xxx一直提示brew update,可以按一次ctrl + c,停掉update,直接去下载安装程序

1. 安装

终端输入自动安装():

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. 卸载

终端输入自动卸载:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

3. 使用

常用命令,在终端中直接敲(注释就不用加了),比如安装maven:

brew install maven //安装软件
brew uninstall maven //卸载软件
brew search maven //搜索软件
brew upgrade maven //更新软件
brew list //查看已安装列表
brew update //更新Homebrew

4. 如何用Homebrew安装指定版本的软件?

1.查看可安装的软件版本

xxx:~ xxx$ brew search maven
==> Formulae
maven ✔ maven-completion maven-shell [email protected] [email protected] [email protected]

==> Casks
mavensmate

2.指定版本安装

xxx:~ xxx$ brew install [email protected]
Updating Homebrew...
^C==> Downloading https://www.apache.org/dyn/closer.cgi?path=maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
==> Downloading from http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
######################################################################## 100.0%
==> Caveats
[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have [email protected] first in your PATH run:
echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile
==> Summary
/usr/local/Cellar/[email protected]/3.5.4: 104 files, 10.2MB, built in 56 seconds
==> brew cleanup has not been run in 30 days, running now...

你可能感兴趣的:(Mac下Homebrew的安装与使用(安装指定版本的软件))