LoginSignup
9
4

More than 5 years have passed since last update.

brew install時の''/usr/local/Homebrew/.git/index.lock': Permission denied'の対処方法

Last updated at Posted at 2018-06-23

はじめに

初歩的だとは思いますが、brew install時に
/usr/local/Homebrew/.git/index.lock': Permission denied'
となってしまいinstallができない際の対処方法を備忘録を含め記録として残したいと思います。

①sudo chown -R $(whoami) $(brew --prefix)の実行をすることで解決。

Cannot save the current index state
Error: Could not 'git stash' in /usr/local/Homebrew!
Please stash/commit manually if you need to keep your changes or, if not, run:
  cd /usr/local/Homebrew
  git reset --hard origin/master

とターミナルから返答があったっため、

  cd /usr/local/Homebrew
  git reset --hard origin/master`

指示通りに実行しましたが、

fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': Permission denied

とのことで拒否をされてしまいました。

以下のコマンドを押下することで無事にインストールができるようになりました。

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

引用元
https://www.jianshu.com/p/197212d6a4c3
https://blog.csdn.net/jinleis/article/details/75029912

解決はしましたが、理由に自信が無いためコマンド入力の際はご注意頂ければ幸いです。

9
4
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
9
4