brew doctor 的错误提示:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/username/.pyenv/shims/python2-config
  /Users/username/.pyenv/shims/python2.7-config
  /Users/username/.pyenv/shims/python-config
  /Users/username/.pyenv/shims/python3-config
  /Users/username/.pyenv/shims/python3.8-config

解决方法:https://github.com/pyenv/pyenv/issues/106 randy3k commented on 22 Apr 2015

写入 ~/.bash_profile 或 ~/.zshrc 中:

alias brew="env PATH=${PATH//$(pyenv root)\/shims:/} brew"

如果你安装了 VMware Fusion,可能会出现错误提示:

$ brew doctor
env: Fusion.app/Contents/Public:/Library/Apple/usr/bin: No such file or directory

执行 echo ${PATH//$(pyenv root)\/shims:/} 会看到原因:

.../Applications/VMware Fusion.app/Contents/Public...

VMware Fusion 的环境变量没有被 \<space> 转义,这个 PATH 似乎在大部分情况下都可以正常运行,甚至直接在终端执行 env PATH=${PATH//$(pyenv root)\/shims:/} brew doctor 都可以正常运行,但是在 alias 命令下却因为这个没有转义的空格而发生错误了。

所以自己加一个转义就好了,编辑 /etc/paths.d/com.vmware.fusion.public

/Applications/VMware Fusion.app/Contents/Public

更改为:

/Applications/VMware\ Fusion.app/Contents/Public