Python
homebrew
pyenv
python3

brew doctorでconfigに関するWarningが出たときの対処法メモ(Homebrewとpyenvが干渉)

前提

環境 macOS 10.12.6
homebrewpyenv両方からpython3を入れた。
brew doctorを実行すると、

以下のような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 and just ignore them. 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/.pyenv/shims/python-config
  /Users/username/.pyenv/shims/python3-config
  /Users/username/.pyenv/shims/python3.6-config
  /Users/username/.pyenv/shims/python3.6m-config

対処方法

.bash_profileにaliasを追加する。

以下コマンドを実行することでbash_profileを編集できます。
(usernameの部分は適宜書き換えて下さい)

echo 'alias brew="env PATH=${PATH/\/Users\/username\/\.pyenv\/shims:/} brew"' >> .bash_profile`

再起動をして再度brew doctor

$ brew doctor
Your system is ready to brew.
Warningを消し去ることができました!

参考文献

http://www.task-notes.com/entry/20141223/1419324649