brew 安装 MySQL、Redis、Maven 报错
还没有安装 brew 的 看这里
使用 brew 安装环境报错信息如下:
==> Pouring openssl@1.1-1.1.1k.arm64_big_sur.bottle.tar.gz
tar: Error opening archive: Failed to open ‘/Users/jj/Library/Caches/Homebrew/downloads/462f3e90190034c58b26aa1e9b9db816dc4659712f231edaf4ad923cc9e0c3cc–openssl@1.1-1.1.1k.arm64_big_sur.bottle.tar.gz’
Error: Failure while executing;tar --extract --no-same-owner --file /Users/xx/Library/Caches/Homebrew/downloads/462f3e90190034c58b26aa1e9b9db816dc4659712f231edaf4ad923cc9e0c3cc--openssl@1.1-1.1.1k.arm64_big_sur.bottle.tar.gz --directory /private/tmp/d20211213-5932-ozi62k
exited with 1. Here’s the output:
tar: Error opening archive: Failed to open ‘/Users/xx/Library/Caches/Homebrew/downloads/462f3e90190034c58b26aa1e9b9db816dc4659712f231edaf4ad923cc9e0c3cc–openssl@1.1-1.1.1k.arm64_big_sur.bottle.tar.gz’
解决办法:
unset HOMEBREW_BOTTLE_DOMAIN
没错,就是这一行指令,简单粗暴!!!
Java8 JDK 安装指令
brew tap homebrew/cask-versions
brew cask install java8
# 等待安装完成,执行下面查看 Java 版本
java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.292-b10, mixed mode)
MySQL@5.7 安装指令
brew install mysql@5.7
# 等待安装完成,配置环境变量
echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
echo 'export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"' >> ~/.zshrc
cat ~/.zshrc
# 检查文件正确输出之后,重启终端就可以使用 mysql 指令设置
mysql_secure_installation
Redis 安装指令
brew install redis
# 等待完成之后,启动 redis 服务,才能使用 redis 指令
/opt/homebrew/opt/redis/bin/redis-server /opt/homebrew/etc/redis.conf
redis-server
redis-cli
# 或者直接使用 brew 的启动 redis 命令
brew services start redis
Maven 安装指令
brew install maven
# 等待安装完成,执行指令查看版本信息
mvn -version
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
Maven home: /opt/homebrew/Cellar/maven/3.8.2/libexec
Java version: 17, vendor: Homebrew, runtime: /opt/homebrew/Cellar/openjdk/16.0.2/libexec/openjdk.jdk/Contents/Home
Default locale: zh_CN_#Hans, platform encoding: UTF-8
OS name: "mac os x", version: "11.5.2", arch: "aarch64", family: "mac"