brew doctor symlink error



最近macbookが初期化され、brew updatebrew doctorを実行してPostgreSQLを再インストールする過程でエラーが見つかりました.
参考までに、brew doctorコマンドはhomebrewの自己診断ツールで、すべてのものが正常に動作しているかどうかを確認し、問題を報告し、解決方法を教えてくれます.
発生したエラーメッセージは次の2つです.

  • Warning: "config"scripts exist outside your system or Homebrew directories.

  • Warning: You have unlinked kegs in your Cellar.
  • mac@MacBookPro ~ % 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:
      /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5m-config
      /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5-config
      /Library/Frameworks/Python.framework/Versions/3.5/bin/python3-config
    
    Warning: You have unlinked kegs in your Cellar.
    Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
    those kegs to fail to run properly once built. Run `brew link` on these:
      [email protected]

    fix You have unlinked kegs in your Cellar error


    まずは次のWarning: You have unlinked kegs in your Cellar.から解決しましょう.
    間違った情報をよく読むと、Run brew link on these: [email protected]をするように親切に教えてくれます.brew linkはsymlinksを生成するコマンドで、python 3.9バージョンのパス参照エラーかもしれません.
    mac@MacBookPro ~ % brew link [email protected]
    試行後に次のエラーが発生しました.
    mac@MacBookPro ~ % brew link [email protected]
    Linking /usr/local/Cellar/[email protected]/3.9.12... 
    Error: Could not symlink bin/2to3
    Target /usr/local/bin/2to3
    already exists. You may want to remove it:
      rm '/usr/local/bin/2to3'
    
    To force the link and overwrite all conflicting files:
      brew link --overwrite [email protected]
    
    To list all files that would be deleted:
      brew link --overwrite --dry-run [email protected]
    /usr/local/bin/2to3に既にあり、symlinkを生成できません.消去して上書きしてください.言いつけどおりに進める.
    mac@MacBookPro ~ % rm '/usr/local/bin/2to3'
    mac@MacBookPro ~ % brew link --overwrite [email protected]
    Linking /usr/local/Cellar/[email protected]/3.9.12... 24 symlinks created.
    brew doctorを実行し、Warning: You have unlinked kegs in your Cellar.エラーが消え、1つのエラーしか残っていないことを確認できます.
    mac@MacBookPro ~ % 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:
      /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5m-config
      /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5-config
      /Library/Frameworks/Python.framework/Versions/3.5/bin/python3-config

    fix "config" scripts exist outside your system or Homebrew directories error

    Warning: "config" scripts exist outside your system or Homebrew directories.エラーの解決方法はstackoverflowで助けられた.
    まずconfigscripts付きpathディレクトリをすべて削除します.
    mac@MacBookPro ~ % rm /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5m-config
    mac@MacBookPro ~ % rm /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5-config
    mac@MacBookPro ~ % rm /Library/Frameworks/Python.framework/Versions/3.5/bin/python3-config
    その後、brew doctorを再実行します.
    mac@MacBookPro ~ % 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: Broken symlinks were found. Remove them with `brew cleanup`:
      /usr/local/bin/python3.5-config
      /usr/local/bin/python3.5m-config
    では、brew cleanupでBroken symlinksをクリアします.コマンドcleanupを使用して、brew doctorを再実行します.
    mac@MacBookPro ~ % brew doctor 
    Your system is ready to brew.
    こつこつ!解決しました.