macOS 10.15 brew Error: [email protected] has been disabled because it is not supported upstream! 异常解决方法

在macOS 10.15中使用brew安装[email protected]时会提示已经被禁止,原因是上游不支持. 这个是因为目前苹果对10.15版本的系统已经不再支持导致. 

异常信息:

brew install [email protected]
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/formula.jws.jso
#=#=#                                                                          
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/api/cask.jws.json
#=#=#                                                                          
Warning: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

Error: [email protected] has been disabled because it is not supported upstream!

解决方法1: 直接改用 macport包管理工具

这个方法就很简单了, 直接使用以下命令安装即可,前提是你已经安装了macport, 安装方法见:  macos MacPort 包管理工具安装和使用-CSDN博客

sudo port install mariadb-10.3

注意: port 里面的软件包的命名规则和brew稍有不同,port里面是 mariadb-10.3 而brew里面是 [email protected]

解决方法2: 编辑本地的tap,将禁用那个提示注释

直接执行以下命令即可,注意如果你本地没有clone过tap参考源码,这个命令会自动全量克隆源码

HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]

手动浅克隆homebrew-core taps源码

当然,如果你不想全量克隆brew core源码,可以手动浅克隆(既在git clone时 指定--depth=1参数)

# 浅克隆 --depth=1 
# 指定克隆的地址为 /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
# 
git clone --depth=1 https://mirrors.ustc.edu.cn/homebrew-core.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core

注意:

1. 上面的 /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core 这个是brew默认读取本地homebrew-core 这个tap的路径,只能是这个,否则不生效!

2. 阿里的brew加速地址在git clone时没有进度,貌似不能使用git clone访问,所以换成ustc的镜像

3. 如果需要使用 brew services 命令来管理安装的应用的服务,则必须要使用全量克隆! 

使用brew edit 命令编辑本地tap 

直接使用命令 brew edit  [email protected] 就可以打开指定的tap进行编辑, 如下:

macOS 10.15 brew Error: mariadb@10.3 has been disabled because it is not supported upstream! 异常解决方法_第1张图片

最后的效果

注意, 使用 brew edit  xxx 这个命令的前提是你必须要配置HOMEBREW_EDITOR环境变量 , 如:vscode编辑器命令行工具:  

export HOMEBREW_EDITOR="/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"

编辑完成,保存后再次使用以下命令进行安装

HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]

注意这里的 HOMEBREW_NO_INSTALL_FROM_API=1  临时环境变量是指定brew使用本地taps, 如果不指定就会使用api中的taps, 那样的话你的本地修改就没有作用了!!!

再次执行brew命令后的截图

macOS 10.15 brew Error: mariadb@10.3 has been disabled because it is not supported upstream! 异常解决方法_第2张图片

如果不出意外,这次就可以正常安装brew禁用的软件包 [email protected] 了.

最终结果,如果出现下面的界面表示安装成功!

macOS 10.15 brew Error: mariadb@10.3 has been disabled because it is not supported upstream! 异常解决方法_第3张图片

[email protected] 服务环境配置

将上面的提示信息加入到 ~/.bash_profile


###### mariadb
# 启动服务: brew services start [email protected]
# 
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
export CPPFLAGS="-I/usr/local/opt/[email protected]/include"
export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

source ~/.bash_profile  生效环境配置

[email protected] 自定义数据库文件存储路径

brew安装的mariadb的datadir目录定义是在 安装路径中的 .plist 文件中定义,这个和linux里面的是不同的哦!

自定义数据库存储路径: 安装文件夹下的.plist文件和.service中修改 datadir 
使用编辑器打开文件  /usr/local/Cellar/[email protected]/[email protected]

然后将默认的 datadir路径 /usr/local/var/mysql  修改为你自己想要的路径即可, 如:  /Users/xxx/opt/[email protected]/data

macOS 10.15 brew Error: mariadb@10.3 has been disabled because it is not supported upstream! 异常解决方法_第4张图片

设置完成后执行命令  brew services start [email protected]  即可成功启动mariadb服务

总结:   brew安装已经禁用的软件包稍微复杂, 非brew情怀还是禁用大家使用macport这个包管理工具来安装吧,这个针对旧版本的macos有专门的优化和相关的port入口, 很多brew里面无法安装的旧版本软件包在这个里面都可以顺利的安装,如 xz, python, maridb等

附 brew install [email protected] 完整安装日志

这个日志记录了brew编译安装[email protected]的步骤和使用配置等信息, 对于后期问题的排查和定义具有很重要的意义!

 ~ % HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]
Error: 
  homebrew-core is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
Warning: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

==> Fetching dependencies for [email protected]: bison, cmake, mecab, mecab-ipadic, msgpack, groonga and [email protected]
==> Fetching bison
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bison-3.8.2.catalina.bottle.tar.gz
Already downloaded: /Users/MyMac/Library/Caches/Homebrew/downloads/25f37e908ca3ea2d632e3d0da5f686db451e42291a1270dd16817c0fd67a09d3--bison-3.8.2.catalina.bottle.tar.gz
==> Fetching cmake
==> Downloading https://github.com/Kitware/CMake/releases/download/v3.30.2/cmake-3.30.2.tar.gz
Already downloaded: /Users/MyMac/Library/Caches/Homebrew/downloads/4c665536aee664903c7c08ee838466021d3268019762ebf00cef54715ba8f045--cmake-3.30.2.tar.gz
==> Fetching mecab
==> Downloading https://deb.debian.org/debian/pool/main/m/mecab/mecab_0.996.orig.tar.gz
Already downloaded: /Users/MyMac/Library/Caches/Homebrew/downloads/687bcdf54ee2f790b6106b0bfa91c765e01f4915079cc283cd5dc26d3eedfa4c--mecab_0.996.orig.tar.gz
==> Fetching mecab-ipadic
==> Downloading https://deb.debian.org/debian/pool/main/m/mecab-ipadic/mecab-ipadic_2.7.0-20070801+main.orig.tar.gz
Already downloaded: /Users/MyMac/Library/Caches/Homebrew/downloads/6a8b854995b6681d2487b6b4fb697ea235156fef40d08372b63dc252af6d0d1a--mecab-ipadic_2.7.0-20070801+main.orig.tar.gz
==> Fetching msgpack
==> Downloading https://github.com/msgpack/msgpack-c/releases/download/c-6.1.0/msgpack-c-6.1.0.tar.gz
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/4879511/77a81aef-35e8-493d-8d5
######################################################################################################################### 100.0%
==> Fetching groonga
==> Downloading https://packages.groonga.org/source/groonga-normalizer-mysql/groonga-normalizer-mysql-1.2.1.tar.gz
######################################################################################################################### 100.0%
==> Downloading https://github.com/groonga/groonga/releases/download/v14.0.6/groonga-14.0.6.tar.gz
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/107202/ee211065-c88b-4b4c-a63e
######################################################################################################################### 100.0%
Warning: [email protected] has been deprecated because it is not supported upstream!
==> Fetching [email protected]
==> Downloading https://www.openssl.org/source/openssl-1.1.1w.tar.gz
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/7634677/b4c6e1f3-d928-4de0-a50
######################################################################################################################### 100.0%
==> Fetching [email protected]
==> Downloading https://archive.mariadb.org/mariadb-10.3.39/source/mariadb-10.3.39.tar.gz
######################################################################################################################### 100.0%
==> Installing dependencies for [email protected]: bison, cmake, mecab, mecab-ipadic, msgpack, groonga and [email protected]
==> Installing [email protected] dependency: bison
==> Pouring bison-3.8.2.catalina.bottle.tar.gz
  /usr/local/Cellar/bison/3.8.2: 99 files, 3.7MB
==> Installing [email protected] dependency: cmake
==> ./bootstrap --prefix=/usr/local/Cellar/cmake/3.30.2 --no-system-libs --parallel=8 --datadir=/share/cmake --docdir=/share/doc
==> make
==> make install
  /usr/local/Cellar/cmake/3.30.2: 3,423 files, 61.2MB, built in 13 minutes 55 seconds
==> Installing [email protected] dependency: mecab
==> ./configure --sysconfdir=/usr/local/etc
==> make install
  /usr/local/Cellar/mecab/0.996: 17 files, 4.4MB, built in 43 seconds
==> Installing [email protected] dependency: mecab-ipadic
==> ./configure --with-charset=utf8 --with-dicdir=/usr/local/Cellar/mecab-ipadic/2.7.0-20070801/lib/mecab/dic/ipadic
==> make install
  /usr/local/Cellar/mecab-ipadic/2.7.0-20070801: 14 files, 50.6MB, built in 7 seconds
==> Installing [email protected] dependency: msgpack
==> cmake -S . -B build -DMSGPACK_BUILD_TESTS=OFF
==> cmake --build build
==> cmake --install build
  /usr/local/Cellar/msgpack/6.1.0: 38 files, 222.1KB, built in 5 seconds
==> Installing [email protected] dependency: groonga
==> ../configure --disable-zeromq --disable-apache-arrow --with-luajit=no --with-ssl --with-zlib --without-libstemmer --with-mec
==> make install
==> ./configure
==> make
==> make install
  /usr/local/Cellar/groonga/14.0.6: 901 files, 86.1MB, built in 3 minutes 25 seconds
==> Installing [email protected] dependency: [email protected]
==> perl ./Configure --prefix=/usr/local/Cellar/[email protected]/1.1.1w --openssldir=/usr/local/etc/[email protected] no-ssl3 no-ssl3-metho
==> make
==> make install MANDIR=/usr/local/Cellar/[email protected]/1.1.1w/share/man MANSUFFIX=ssl
==> make test
  /usr/local/Cellar/[email protected]/1.1.1w: 8,094 files, 18.5MB, built in 5 minutes 3 seconds
==> Installing [email protected]
==> cmake -S . -B _build -DMYSQL_DATADIR=/usr/local/var/mysql -DINSTALL_INCLUDEDIR=include/mysql -DINSTALL_MANDIR=share/man -DIN
==> cmake --build _build
==> cmake --install _build
==> /usr/local/Cellar/[email protected]/10.3.39/bin/mysql_install_db --verbose --user=tekin --basedir=/usr/local/Cellar/[email protected]/
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

MySQL is configured to only allow connections from localhost by default

To connect:
    mysql -uroot

[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"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

To start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/bin/mysqld_safe --datadir\=/usr/local/var/mysql
==> Summary
  /usr/local/Cellar/[email protected]/10.3.39: 660 files, 171.5MB, built in 9 minutes 48 seconds
==> Running `brew cleanup [email protected]`...
==> Caveats
==> [email protected]
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.

MySQL is configured to only allow connections from localhost by default

To connect:
    mysql -uroot

[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"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

To start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/bin/mysqld_safe --datadir\=/usr/local/var/mysql

你可能感兴趣的:(macos,macos,brew,mariadb,install,brew,edit)