LoginSignup
0
0

More than 1 year has passed since last update.

mac OS Catalina(10.15.7)で brew install をしたら Error: Permission denied @ apply2files というエラーが出た際の対応

Posted at

経緯

brew installbrew upgrade などをした際に、以下のエラーが表示されてしまった

エラー内容

Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins

うまくいった対応

$ sudo chown -R $(whoami) $(brew --prefix)/*

コマンドの意味

brewコマンドでのインストール先のファイル・ディレクトリの所有者を現在のユーザーに変更します

細かく調査

実際にコマンドを打ってみたらすぐわかりました

  • brew --prefix
    • brewコマンドでのインストール先のルートディレクトリを表示
  • $(brew --prefix)/*
    • brewコマンドでのインストール先のファイルたちを指定
  • whoami
    • 現在のユーザー名を表示
  • chown -R
    • man chown をすると書いてありました
      • The chown utility changes the user ID and/or the group ID of the specified files. Symbolic links named by arguments are silently left unchanged unless -h is used.
    • -R については
      • Change the user ID and/or the group ID for the file hierarchies rooted in the files instead of just the files themselves.
      • 要するに指定したファイル以下のファイルのユーザーIDやグループIDを再帰的に変更

ちなみに

sudo brew はもうダメみたいでした

Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.
0
0
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
0
0