1.brew的安装
首先官网有很全的安装及使用方法,以及安装过程中遇到的问题解决。
其次我也有相关记录 https://blog.youkuaiyun.com/a602519773/article/details/84553901
我这里介绍我遇到的问题
安装:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
直接复制,在mac终端执行即可
问题:
在安装过程中可能由于网络原因出现xcode下载安装失败的问题,这个时候需要手动自己安装
同样在终端执行:xcode-select --install
输入后会让你确认安装,点击确定等一会儿问题即可解决。
2.更换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
#更新brew
brew update
# 直接执行一下命令,会写入 ~/.bash_profile,如果想恢复,直接在.bash_profile注掉就可以了
cd
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source .bash_profile
3.brew 常用命令介绍
#安装软件
brew install 包名
#卸载软件
brew uninstall 包名
#更新brew
brew update
#查询包及版本
brew search 包名
4.brew安装zookeeper
终端执行:brew install zookeeper
5.配置zookeeper
我们会发现zookeeper的配置文件在/usr/local/etc/zookeeper/目录下
首先配置zoo.cfg文件
增加一行:server.1 = 用户名:2888:3888
默认的dataDIr是在dataDir=/usr/local/var/run/zookeeper/data
brew安装的软件都会自己配置环境变量,所以不需要我们自己配置。
启动zk:zkServer start