Problem with brew update

Hi guys,

when i run " brew update" i have this result :

Error: /usr/local must be writable!

I run “brew doctor” and it give this advice:

You should probably change the ownership and permissions of /usr/local back to your user account
sudo chown -R $(whoami) /usr/local

When i try that sudo command, i get this error:

chown: /usr/local: Operation not permitted

I tried to replace “$(whoami)” by my user name, but i get the same error.

Thanks for helping a command line newbie :wink:
Vincent

PS: i’m on Mac OS X mojave (10.14.5).

sudo chown -R $(whoami) /usr/local/* should work

Thanks for the reply.
It worked, at least that part: no error when targeting the content of /usr/local/ instead of the directory itself.
But “brew update” still throw that error (as it’s the directory that causes the problem):

Error: /usr/local must be writable!

in that case you’ll have to run sudo chmod +w /usr/local/

same as before… Thanks again for your time.
I’ll try to repair the files permissions at the os level with Onyx (a free GUI tool that never let me down, for now…). I’ll post the progress on my little problem :wink:

What does brew config output?

brew config output (i modified the urls as i can’t post more than 2 links in a post as a new user…):

HOMEBREW_VERSION: 0.9.9
ORIGIN: https github com Homebrew brew
HEAD: 6f80b4688bce7b391093412def6e65c3b61cbd20
Last commit: 3 years, 4 months ago
Core tap ORIGIN: https github com Homebrew homebrew-core
Core tap HEAD: 087514c6f88da9f2ec231be91fde1d9fb144b8c0
Core tap last commit: 3 years, 4 months ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https homebrew bintray com
CPU: quad-core 64-bit ivybridge
OS X: 10.14.5-x86_64
Xcode: 1 => /Applications/Xcode.app/Contents/Developer
CLT: N/A
Clang: N/A
X11: N/A
System Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Perl: /usr/bin/perl
Python: /usr/local/var/pyenv/shims/python => /usr/local/var/pyenv/versions/2.7.11/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Java: 1.6.0_65-b14-468

The context (if it help):
That old version date from an old foray of mine into the wonderful world of the command line that included installing python among other things. The aim, i think, was to install and understand the wordpress tools of roots (sage, bedrock, trellis): it was too complicated for me at the moment (and almost certainly now…) and i uninstalled what i could and abandonned the rest.
Now i want to get back to use command line tools, git, etc.

Your Homebrew is too old. You’ll need to use the instructions at https://github.com/Homebrew/install to uninstall and reinstall.

ok, i’ll do that, thanks!