Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
5
Help us understand the problem. What are the problem?

posted at

Organization

$ brew upradeを実行したら権限系のエラーが出た

目的

  • $ brew upgradeを実行したときに出た権限系のエラーを解決するまでの経緯をまとめる

詳細

  1. $ brew upgradeを実行したら下記のエラーが出た。

    Error: Can't create update lock in /usr/local/var/homebrew/locks!
    Fix permissions by running:
      sudo chown -R $(whoami) /usr/local/var/homebrew
    Error: The following directories are not writable by your user:
    /usr/local/lib/python3.7/site-packages
    /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/lib/python3.7/site-packages /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/lib/python3.7/site-packages /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks
    
  2. ディレクトリの所有権限を変更してくれって言われたら下記を実行する。

    $ sudo chown -R $(whoami) /usr/local/lib/python3.7/site-packages /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks
    
  3. もう一回下記を実行した。

    $ brew upgrade
    
  4. ちょっと進んだけどエラーが出た。

    Error: An exception occurred within a child process:
      Errno::EACCES: Permission denied @ dir_s_mkdir - /usr/local/Cellar/openssl@1.1/1.1.1g
    
  5. 下記を実行してみる。

    $ chmod u+w /usr/local/lib/python3.7/site-packages /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks
    
  6. もう一回下記を実行した。

    $ brew upgrade
    
  7. 改善せずエラーが発生した。

    Error: An exception occurred within a child process:
      Errno::EACCES: Permission denied @ dir_s_mkdir - /usr/local/Cellar/openssl@1.1/1.1.1g
    
  8. 下記のようなエラーが出ていることがわかった。

    touch: /usr/local/Homebrew/.git/FETCH_HEAD: Permission denied
    touch: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.git/FETCH_HEAD: Permission denied
    touch: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/.git/FETCH_HEAD: Permission denied
    fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': Permission denied
    fatal: Unable to create '/usr/local/Homebrew/.git/index.lock': Permission denied
    
  9. エラーで検索したが下記がヒットした。

  10. 下記を実行してディレクトリの権限を変更する。

    $ sudo chown -R $(whoami) $(brew --prefix)/*
    
  11. 下記エラーが出た。

    Error: No such file or directory - /usr/local/Cellar/docker/19.03.13
    
  12. 下記の知見が出てきた。

  13. 下記を実行してみる。

    $ brew install docker docker-machine
    
  14. 再度下記を実行したら正常エラーが出ず実行できた。

    $ brew upgrade
    
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
5
Help us understand the problem. What are the problem?