brew doctor symlink error

lena·2022년 4월 5일
0

최근 맥북을 초기화했는데, 다시 PostgreSQL 을 설치하려고 brew updatebrew doctor 실행하는 도중 에러가 발견되었다.

참고로 brew doctor 명령어는 home brew 의 자체 진단 도구로, 모든 것이 제대로 작동하는지 확인한 다음 문제를 보고하고 해결방법을 알려준다.

발생한 에러 메시지는 아래 두 개이다.

  • 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:
  python@3.9

fix You have unlinked kegs in your Cellar error

일단 아래의 Warning: You have unlinked kegs in your Cellar. 에러부터 해결해보자.

에러 메시지를 잘 읽어보면, Run brew link on these: python@3.9 를 하라고 친절하게 알려주고 있다. brew link 는 symlinks를 생성하는 명령어인데, 아마도 python 3.9 version 의 경로 참조가 잘못된 모양이다.

mac@MacBookPro ~ % brew link python@3.9

시도하니 아래와 같은 에러가 발생했다.

mac@MacBookPro ~ % brew link python@3.9
Linking /usr/local/Cellar/python@3.9/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 python@3.9

To list all files that would be deleted:
  brew link --overwrite --dry-run python@3.9

/usr/local/bin/2to3 에 이미 있어 symlink를 생성할 수 없으니 그것을 지우고 overwrtie 하라고 한다. 시키는대로 진행한다.

mac@MacBookPro ~ % rm '/usr/local/bin/2to3'
mac@MacBookPro ~ % brew link --overwrite python@3.9
Linking /usr/local/Cellar/python@3.9/3.9.12... 24 symlinks created.

brew doctor 를 실행하면 이제 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

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

Warning: "config" scripts exist outside your system or Homebrew directories. 에러의 해결책은 stackoverflow 에서 도움 받았다.

먼저 config scripts 가 있는 path directory 를 전부 지운다.

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 시키라고 알려준다. 명령어를 통해 cleanup 한 후, brew doctor 를 다시 실행하면

mac@MacBookPro ~ % brew doctor 
Your system is ready to brew.

짜잔! 해결된다.

profile
꾸준한게 장점

0개의 댓글