macOSでpyenv
をインストールすると、brew doctor
でconfigまわりのWarningが発生します。
$ 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 what 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/.anyenv/envs/pyenv/shims/python2-config /Users/username/.anyenv/envs/pyenv/shims/python3.7-config /Users/username/.anyenv/envs/pyenv/shims/python2.7-config /Users/username/.anyenv/envs/pyenv/shims/python3.7m-config /Users/username/.anyenv/envs/pyenv/shims/python-config /Users/username/.anyenv/envs/pyenv/shims/python3-config
pyenvのIssueのコメントにあるように以下のエイリアスを設定すると解決します。
alias brew="env PATH=${PATH//$(pyenv root)\/shims:/} brew"
余談
他の記事では、以下のようなエイリアスの紹介がありましたが、$(pyenv root)
の方がほんの少しだけ短くなりますし、anyenv
でpyenv
をインストールした場合でも変える必要がないのでこちらのほうがオススメです。
alias brew="env PATH=${PATH/\/Users\/${USER}\/\.pyenv\/shims:/} brew"