スポンサーリンク

【Mac】OSをBigSurにしたらbrewコマンドが動かなくなった!?その対処

スポンサーリンク

問題

以下のようにbrewコマンドを実行してみたところうまく動かないようだった

bash-3.2$ brew --version
Traceback (most recent call last):
	10: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
	 9: from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
	 8: from /usr/local/Homebrew/Library/Homebrew/global.rb:28:in `<top (required)>'
	 7: from /usr/local/Homebrew/Library/Homebrew/global.rb:28: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)

以下の記事のようにOSバージョンアップによる変更が原因っぽい

MacOS BigSurでHomebrewが失敗する
MohaveからBigSurにアップグレードしたところ、自作が機能しなくなったこと……

解決

以下コマンドを実行

brew upgrade

bash-3.2$ brew upgrade
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
abseil                                   libhand

・・・

globus-toolkit             pbrt

Error: The following directories are not writable by your user:
/usr/local/share/man/man8

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/share/man/man8

And make sure that your user has write permission.
  chmod u+w /usr/local/share/man/man8

上記でbrewコマンドは使えるようになった

自分の場合はman8フォルダへのアクセス権がなかったのでエラーが最後に出ました

なので以下のように追加実行

bash-3.2$ sudo chown -R $(whoami) /usr/local/share/man/man8
Password:
bash-3.2$ chmod u+w /usr/local/share/man/man8

コメント

タイトルとURLをコピーしました