본문 바로가기
기타/Mac

MacOS에서 brew install 실행시 에러 발생

by A6K 2022. 10. 18.

macOS에서 패키지 관리를 편하게 해주는 소프트웨어인 brew를 이용해서 패키지를 설치하다가 다음 에러를 만나게 되었다.

$ brew install jq
Error: 
  homebrew-core is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
Traceback (most recent call last):
11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:31:in `<main>'
10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:31:in `require_relative'
9: from /usr/local/Homebrew/Library/Homebrew/global.rb:80:in `<top (required)>'
8: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
7: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
6: from /usr/local/Homebrew/Library/Homebrew/os.rb:7:in `<top (required)>'
5: from /usr/local/Homebrew/Library/Homebrew/os.rb:43:in `<module:OS>'
4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:60:in `prerelease?'
3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:28:in `version'
2: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:32:in `from_symbol'
1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:32:in `fetch'
/usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:32:in `block in from_symbol': unknown or unsupported macOS version: :dunno (MacOSVersionError)

macOS는 메이저 버전 업그레이드를 할 때마다 실행환경에서 이런 에러가 발생한다. 매번 문제의 원인을 찾아서 해결해야하는게 여간 번거로운게 아니다.

해결방법은 에러 메시지에 나와 있다. 다음 명령을 실행하면 된다.

$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
remote: Enumerating objects: 827059, done.
remote: Counting objects: 100% (827021/827021), done.
remote: Compressing objects: 100% (281164/281164), done.
remote: Total 817661 (delta 550714), reused 800533 (delta 533628), pack-reused 0
Receiving objects: 100% (817661/817661), 317.11 MiB | 3.71 MiB/s, done.
Resolving deltas: 100% (550714/550714), completed with 8258 local objects.
From https://github.com/Homebrew/homebrew-core
   6e04d4a051e..28060474399 master     -> origin/master

그러면 brew install 명령이 정상 동작하게 된다.

댓글