LoginSignup
2
5

More than 3 years have passed since last update.

macOSをMojaveからBig SurにアップデートしたらHomebrewが起動しなくなった

Posted at

はじめに

久しぶりの投稿になります。
先日、macOSをMojaveからBig Sur(11.1)にアップデートしたところ、Homebrewが起動しなくなってしまいました。

brew doctorを実行した画面

~ % brew docter
Traceback (most recent call last):
    11: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
    10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
     9: from /usr/local/Homebrew/Library/Homebrew/global.rb:29:in `<top (required)>'
     8: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /usr/local/Homebrew/Library/Homebrew/os.rb:3:in `<top (required)>'
     5: from /usr/local/Homebrew/Library/Homebrew/os.rb:21:in `<module:OS>'
     4: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:58:in `prerelease?'
     3: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `version'
     2: from /usr/local/Homebrew/Library/Homebrew/os/mac.rb:24:in `new'
     1: from /usr/local/Homebrew/Library/Homebrew/os/mac/version.rb:26:in `initialize'
/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)

解決方法

Homebrewのトラブルシューティングを確認すると「まずはbrew updateを試して」とあったので、実行したところ、先程のエラーは表示されませんでした。

実行画面

~ % brew update
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
〜以下略〜

以下、Homebrewのサイトを確認すると、「Homebrew 2.6.0」からBig Surをサポートしているとのこと。
2.6.0 ― Homebrew

補足

brew doctorを実行したところ、ちゃんと? Warningが出てきたので、Homebrew自体の起動はうまくいっているようです:cry:

~ % 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: Your Command Line Tools are too outdated.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you an update run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.


Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you an update run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.


Warning: The following directories do not exist:
/usr/local/Frameworks

You should create these directories and change their ownership to your account.
  sudo mkdir -p /usr/local/Frameworks
  sudo chown -R $(whoami) /usr/local/Frameworks

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  gettext

Warning: Your CLT does not support macOS 11.
It is either outdated or was modified.
Please update your CLT or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you an update run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/more/.

(自分の環境では)Warningは5つありますが、エラー内容を見ると同時に解決できそうなものもありますので、実際は
1. CommandLineToolsのアップデート

解決法
ターミナルでsoftwareupdate --all --install --forceを実行しても
Software Update Tool

Finding available software
No updates are available.

となったので

~ % sudo rm -rf /Library/Developer/CommandLineTools
Password:(管理者パスワード)

~ % sudo xcode-select --install
xcode-select: note: install requested for command line developer tools

を実行し、一度削除してから、再度インストールすることで解決しました。


2. Frameworks のディレクトリ作成と権限設定
解決法
ターミナルで


~ % sudo mkdir -p /usr/local/Frameworks
Password:(管理者パスワード)

を実行し
~ % whoami
(現在のユーザ名)

whoamiコマンドで、現在のユーザ名を確認し、

~ % sudo chown -R (現在のユーザ名)/usr/local/Frameworks

を実行し、解決しました。


3. gettext パッケージの有効化(link化)
解決法
ターミナルで


~ % brew link gettext

を実行して
Linking /usr/local/Cellar/gettext/0.19.8.1... 185 symlinks created

上記の通り、パッケージの有効化を行い解決しました。

上記3つの対応で解決しました。
お役に立てれば幸いです。

2
5
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
5