LoginSignup
61
47

More than 5 years have passed since last update.

brew update: /usr/local 権限周りの問題=更新で解消

Last updated at Posted at 2016-09-22

環境

  • MacBook (Retina, 12-inch, Early 2015)
  • macOS Sierra(バージョン10.12)

not writable エラーで brew update できない

macOS Sierra(バージョン10.12)へ更新したついでに brew update を行ってみると

$ brew update
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.

You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami):admin /usr/local
  • /usr/local が not writable なので更新できません
  • ownership と permission を変更してみては

と表示される。

ownership を変更してから brew update

指示通り、以下のように実施すると更新できた:

$ sudo chown -R $(whoami):admin /usr/local
$ brew update
Checking out files: 100% (3753/3753), done.
==> Migrating Homebrew to v0.9.9
remote: Counting objects: 923, done.
remote: Compressing objects: 100% (814/814), done.
remote: Total 923 (delta 228), reused 511 (delta 85), pack-reused 0
Receiving objects: 100% (923/923), 670.29 KiB | 589.00 KiB/s, done.
Resolving deltas: 100% (228/228), completed with 156 local objects.
From https://github.com/Homebrew/brew
 + eb4538c...bbed724 master     -> origin/master  (forced update)
HEAD is now at bbed724 Merge pull request #1078 from ilovezfs/cmake-weak-symbols
==> Homebrew has enabled anonymous aggregate user behaviour analytics
Read the analytics documentation (and how to opt-out) here:
  https://git.io/brew-analytics
==> Tapping homebrew/core
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3725, done.
remote: Compressing objects: 100% (3617/3617), done.
remote: Total 3725 (delta 15), reused 1247 (delta 0), pack-reused 0
Receiving objects: 100% (3725/3725), 2.91 MiB | 517.00 KiB/s, done.
Resolving deltas: 100% (15/15), done.
Checking connectivity... done.
Tapped 3604 formulae (3,752 files, 9M)
Already up-to-date.
==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local

表示されたメッセージ末尾に以下があるのに気づいた:

  • '/usr/local' に対する ownership はもう不要です
  • 必要なら初期値に戻してもいいですよ

ownership を初期値に戻してから brew update

$ sudo chown root:wheel /usr/local
$ brew update
Already up-to-date.

その通り、初期値に戻して再度 brew update しても更新完了するようになっている。

更新後のバージョンは下記の通り

$ brew --version
Homebrew >1.0.0 (no git repository)
Homebrew/homebrew-core (git revision 7ae6; last commit 2016-09-22)

以下のやりとりの通り、わりと最近のissue(opened this issue 5 days ago on 2016/09/22)で対処されたようだ

/usr/local/Homebrew migration tracking issue #987

補足

  • git 版は使っていませんが、おそらく同じ挙動を得られると思います
  • 新規インストールであれば、この対処が済んだバージョンをインストールするので、ownership 変更はそもそも不要と思います
61
47
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
61
47