LoginSignup
2
0

More than 3 years have passed since last update.

brew doctorの*-configに関するwarningを解決する

Last updated at Posted at 2020-04-14

brew doctorしたとき、*-configがーと警告が出たので解決した自分用メモ。

目的

brew doctorを行った際、PATHの中に*-configがあると、Homebrewでインストールされるソフトウェアを混乱させる可能性があるという警告が出力されました。
以下の複数ケースがあるため両方の解決方法について記述します。

  • 対象のディレクトリが一つの場合
  • 対象のディレクトリが複数の場合

*-configがひとつのディレクトリだけにある場合

# brew doctor                                                                                                                                                                                                                                           
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:
  /opt/ImageMagick/bin/MagickCore-config
  /opt/ImageMagick/bin/MagickWand-config
  /opt/ImageMagick/bin/Magick++-config
  /opt/ImageMagick/bin/Wand-config
  /opt/ImageMagick/bin/Magick-config

.zshrc または .bash_profileに以下のようにエイリアスを追記をします。

ターミナルで実行
echo 'alias brew="env PATH=${PATH/\/opt\/ImageMagick/\bin:/} brew"' >> .zshrc

*-configが複数のディレクトリに対してある場合

*-configが下記のように複数のディレクトリにある場合

# brew doctor                                                                                                                                                                                                                                           
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:
  /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config
  /Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
  /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
  /opt/ImageMagick/bin/MagickCore-config
  /opt/ImageMagick/bin/MagickWand-config
  /opt/ImageMagick/bin/Magick++-config
  /opt/ImageMagick/bin/Wand-config
  /opt/ImageMagick/bin/Magick-config

対象のディレクトリが単一の場合は、結構検索でも知ることができますが、複数のケースだとどのように記述すればよいのか分かりませんでした。
その後、検索ワードを変えたりして検索してみたところ、以下のブログに詳しい解説や書き方の仕組みについて記述している方がいたのでそちらを参考に記述してみたら見事解決しました。

brew doctorで*-configが複数のディレクトリにあるときの警告の対処法
*-configが複数のディレクトリにあるときの対処法を書いておきます。

参考ブログと同様に.zshrc または .bash_profileに以下のようにエイリアスを入れ子の状態にして追記するようにコマンドを実行します。

ターミナルで実行
echo 'alias brew="env PATH=${${PATH/\/Library\/Frameworks\/Python\.framework\/Versions\/3\.4\/bin:/}/\/opt\/ImageMagick\/bin:/} brew"' >> .zshrc

どちらかの対処を行った後、以下のコマンドを実行して同じ出力になれば完了です。
※同様のエラーがまだ出る場合は、タイプミスをしていないか確認しましょう。
※異なるエラーが出る場合は、今回のエラーとば異なるエラーが残っている可能性があるため、エラー文の確認しましょう。

# brew doctor
Your system is ready to brew.

参考

HomebrewでdoctorしたらWarning: "config" scripts exist outside your system or Homebrew directories.となった時の対応方法
brew doctorで*-configが複数のディレクトリにあるときの警告の対処法

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0