How should I fix this?

Tue Oct 31 21:52:56 mona@dhcp-wifi-8021x-155-41-82-88:~$ brew update && brew upgrade && brew cleanup
Error: /usr/local is not writable. You should change the
ownership and permissions of /usr/local back to your
user account:
  sudo chown -R $(whoami) /usr/local
Wed Nov 01 20:41:30 mona@dhcp-wifi-8021x-155-41-82-88:~$ sudo chown -R $(whoami) /usr/local
chown: /usr/local: Operation not permitted

sys info:

Wed Nov 01 20:42:36 mona@dhcp-wifi-8021x-155-41-82-88:~$ uname -a
Darwin dhcp-wifi-8021x-155-41-53-197.bu.edu 17.0.0 Darwin Kernel Version 17.0.0: Thu Aug 24 21:48:19 PDT 2017; root:xnu-4570.1.46~2/RELEASE_X86_64 x86_64


Wed Nov 01 20:44:03 mona@dhcp-wifi-8021x-155-41-82-88:~$ brew config
HOMEBREW_VERSION: >1.2.0 (shallow or no git repository)
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 38209aadbfe4fd0c6772467c4bc5c63325d53f6c
Last commit: 1 year, 3 months ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 839ca7b9b4ce034b5abdb66cee0ef75bbb675ddf
Core tap last commit: 1 year, 3 months ago
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit haswell
Homebrew Ruby: 2.3.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
GCC-4.2: build 5666
Clang: 8.0 build 800
Git: 2.9.2 => /usr/local/bin/git
Perl: /usr/bin/perl
Python: /Users/mona/anaconda/bin/python => /Users/mona/anaconda/bin/python3.6
Ruby: /Users/mona/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
Java: 1.8.0_71, 1.7.0_60
macOS: 10.13-x86_64
Xcode: 8.0
X11: 2.7.11 => /opt/X11
Wed Nov 01 20:44:25 mona@dhcp-wifi-8021x-155-41-82-88:~$ 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 change the ownership and permissions of /usr/local
back to your user account.
  sudo chown -R $(whoami) /usr/local

Warning: Anaconda is known to frequently break Homebrew builds, including Vim and
MacVim, due to bundling many duplicates of system and Homebrew-available

If you encounter a build failure please temporarily remove Anaconda
from your $PATH and attempt the build again prior to reporting the
failure to us. Thanks!

Warning: python is symlinked to python3
This will confuse build scripts and in general lead to subtle breakage.

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

4 Answers 4


Try disabling System Integrity Protection.

  • 1
    Disabling SIP indeed worked on my Mojave machine.
    – 2540625
    Nov 14, 2018 at 18:42

I was getting this when trying to update brew so the easier way that worked for me:

sudo chown -R $(whoami) $(brew --prefix)/*
  • 1
    Did not work for me. Owner of /usr/local/* are changed, but update brew still fails.
    – Mikrasya
    Jun 24, 2018 at 19:06
  • Could you provide a little more context as to what this does exactly, please?
    – 2540625
    Nov 14, 2018 at 18:13
  • brew --prefix is the same as /usr/local but the difference from the above answer is that this updates the ownership of the children of /usr/local than /usr/local itself and this worked for me as opposed to changing the ownership of /usr/local itself
    – Swami PR
    Aug 17, 2019 at 17:48
  • @SwamiPR Can you tell me what you did that was different from this answer? I had the same experience as you, but don't know how to fix.
    – skybondsor
    Jan 13, 2020 at 20:29

The solution to this problem is simple copy the /usr/local path then paste it in the dialog box which appears after pressing Command+Shift+G.

After your /usr/local folder items simply press Command+I and the window which supports will be an info window now scroll to the bottom of the window and check the read and write permission and if you don't see your username there then add your username/admin account by pressing the add icon

  • 1
    Unfortunately in High Sierra it says: operation can't be completed because you don't have the necessary permission. Dec 8, 2017 at 0:31
  • What Barnabas said. Dec 9, 2017 at 11:31
  • @BarnabasSzabolcs To solve the operation not permitted issue boot into recovery mode and in a shell window/terminal window which you can access from the utilities option from the menu bar once you are inside the recovery mode screen, now in the terminal window type in this command csrutil disable (there will be a space after csrutil) what this does is that it disables System Integrity Protection which is giving you the operation error after disabling SIP try to do what I have told you to do in my answer!
    – Sayan
    Dec 9, 2017 at 20:00
  • wow, that sounds like you had to dig deep into this thing... Thanks @Sayan! Dec 10, 2017 at 1:43
  • @Sayan you should give disabling SIP as your answer. That was what helped me.
    – matt
    Jun 17, 2018 at 17:06

Turning off SIP, without understanding the risks and second and third effects made me uncomfortable.

Reinstalling Homebrew worked for me

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

With credit to: https://stackoverflow.com/questions/48228030/chown-usr-local-operation-not-permitted-issue-with-brew-update-usr-local-i

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.