`brew cleanup` 命令不会删除旧的 mysql 目录

The `brew cleanup` command does not remove an old mysql directory

当我执行 brew outdated 时,我得到了很多东西

做完后brew cleanup期待去掉5.7.21(因为是旧的)出现在很多东西中:

即使执行了上一次,5.7.21 仍然存在。我本来希望看到删除前者并至少保留后者

如果我执行 brew info mysql 我得到:

mysql: stable 8.0.17
Open source relational database management system
https://dev.mysql.com/doc/refman/8.0/en/
Conflicts with:
  mariadb (because mysql, mariadb, and percona install the same binaries.)
  mariadb-connector-c (because both install plugins)
  mysql-connector-c (because both install MySQL client libraries)
  percona-server (because mysql, mariadb, and percona install the same binaries.)
/usr/local/Cellar/mysql/5.7.21 (323 files, 235.0MB)
  Poured from bottle on 2018-01-30 at 11:34:27
/usr/local/Cellar/mysql/5.7.22 (317 files, 235MB) *
  Poured from bottle on 2018-04-19 at 13:34:21
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql.rb
...

我的 Mac 很旧,我无法升级 Homebrew,因此无法将 MySQL 升级到 8.0.17_1

无论如何,我如何才能毫无问题地删除 5.7.21 并保留更高的 5.7.22

我不确定手动删除 /usr/local/Cellar/mysql 中的 5.7.21 目录是否安全。我想让一切保持一致。

实现这个目标的正确方法是什么?

解决方法:直接删除安装文件夹。绝对安全。

brew cleanup 需要安装最新版本。 issue 412 中对此进行了报告。但是没有任何改进。

在未安装最新版本的情况下不允许清理旧版本公式的背后原因是什么?

Technically, Homebrew doesn't consider a formula to be installed unless the latest version it knows of is installed. And because only installed formulae (in the sense I explained here) are checked for older versions that could be cleaned up, this isn't happening.