HYUDORO

勉強したことや日記など

Homebrewインストールがzshのパーミッション起因で失敗した

オフィシャルサイトのコマンドでHomebrewをインストールしようとしたときのこと。OSは10.15.7。

% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
...
...
...
==> Pouring portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
Error: Failed to link all completions, docs and manpages:
  Permission denied @ rb_file_s_symlink - (../../../Homebrew/completions/zsh/_brew, /usr/local/share/zsh/site-functions/_brew)
Failed during: /usr/local/bin/brew update --force --quiet

zsh周りのパーミッションを変更しないといけなさそうだった。 brew doctorsしてみた。

% 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: The following directories are not writable by your user:
/usr/local/share/zsh
/usr/local/share/zsh/site-functions

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

And make sure that your user has write permission.
  chmod u+w /usr/local/share/zsh /usr/local/share/zsh/site-functions

sudo chown -R $(whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions を実行、解決しました。