brew 是 Mac 下的一个包管理工具,作用类似于 centos 下的 yum。
brew 可以用一条命令,就可以在mac上安装、卸载、更新各种软件包,因为brew的使用方便,如今已成为使用mac电脑的程序员的必备工具。
重装了下电脑,很多软件需要重新下载,捣鼓的比较麻烦,所以做了些备注~
PS:如果在国外,可以使用一条命令直接安装成功
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
但是由于在国内的原因,可能出现raw.githubusercontent.com 无法打开的情况
这里提供一种思路,敬请参考~
找一台可翻墙的服务器,获取如下文件,并拉回到本地
curl https://raw.githubusercontent.com/Homebrew/install/master/install.sh >> brew_install.sh
# 安装
sh brew_install.sh
# 提示下次启动时,需要配置这个,所以需要如此,/etc/profile文件中加入两句
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
# 使环境生效
source /etc/profile
# 查看版本
brew --version
# 换源
## 中国科大:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
## 清华大学:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
# 查询
brew search tomcat
# 安装
brew install tomcat
# 制定版本
brew install tomcat@8
# 卸载
brew uninstall tomcat
# 启动
brew services start tomcat
# 停止
brew services stop tomcat
# 重启
brew services restart tomcat
# 列出当前的状态
brew services list
https://stackoverflow.com/questions/29910217/homebrew-installation-on-mac-os-x-failed-to-connect-to-raw-githubusercontent-com
https://blog.csdn.net/u012400885/article/details/103849472