LoginSignup
1
3

More than 5 years have passed since last update.

macOS Sierraへのアップグレード以前からインストールされていたbrewを更新する

Posted at

問題

macOS Sierra以前のEl Capitanなどでbrewをインストールし、クリーンインストールではなく上書きインストールした場合、brew updateを実行しようとするエラーが発生してしまう。

$ brew --version
Homebrew 1.1.9-131-gcf18a99
Homebrew/homebrew-core (git revision bdf98; last commit 2016-04-30)
$ brew update
Error: /usr/local must be writable!

解決法

brew doctorの指示に従って/usr/localのオーナーをsudo chown -R $(whoami) /usr/localで一時的に変更してbrew updateを実行し、実行後にsudo chown root:wheel /usr/localでオーナーを元に戻す。

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: /usr/local is not writable.

You should probably change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami) /usr/local
$ brew update
Updating Homebrew...
==> Auto-updated Homebrew!
(中略)
==> 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
(後略)
$ sudo chown root:wheel /usr/local
1
3
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
1
3