プログラミングスクール最大70%OFF! ←クリックして見に行く

【Mac】brew install / update 時に「The following directories are not writable by your user:」とエラーが出た時の対処法

【Mac】brew install / update 時に「The following directories are not writable by your user:」とエラーが出た時の対処法

brew install コマンド入力時に以下エラーが出た時の
エラー解消方法の備忘録_φ(・_・ )

発生したエラー

Error: The following directories are not writable by your user:
/usr/local/Homebrew
/usr/local/bin
/usr/local/etc/bash_completion.d
/usr/local/lib/pkgconfig
/usr/local/share/aclocal
/usr/local/share/info
/usr/local/share/locale
/usr/local/share/man/man3
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew/locks

You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/Homebrew /usr/local/bin /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/share/aclocal /usr/local/share/info /usr/local/share/locale /usr/local/share/man/man3 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks

And make sure that your user has write permission.
chmod u+w /usr/local/Homebrew /usr/local/bin /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/share/aclocal /usr/local/share/info /usr/local/share/locale /usr/local/share/man/man3 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks

翻訳

エラーが発生しました。次のディレクトリは、あなたのユーザーによって書き込み可能ではありません。
/usr/local/Homebrew
/usr/local/bin…

これらのディレクトリの所有者を自分のユーザーに変更する必要があります。
sudo chown -R $(whoami) /usr/local/Homebrew…

そして、ユーザーに書き込み権限があることを確認します。
chmod u+w /usr/local/Homebrew …

Memo

chmodはパーミッション(許可)を指定するコマンドです。
-R(–recursiveオプション)は、複数ファイルにパーミッション設定する場合、ディレクトリ内も設定対象にすることができます。
uはユーザーアクセス
wは書き込み権限

原因

Updateしようとしているファイルが、自分の権限では変更不可。

解決手順

・エラー文言通りのコマンドでユーザーの書き込みを許可する

sudo chown -R $(whoami) /usr/local/Homebrew /usr/local/bin /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/share/aclocal /usr/local/share/info /usr/local/share/locale /usr/local/share/man/man3 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks

・以下エラーも同時に出たので参考にどうぞ!
【Mac】brew install / update 時に「XXX is not writable. You should change the ownership and permissions of XXX back to your user account:」とエラーが出た時の対処法

参考サイト

https://www.itmedia.co.jp/help/tips/linux/l0506.html

Macカテゴリの最新記事