title: chown: /usr/local: Operation not permitted - issue with brew update /usr/local is not writable - MacOS 10.13.1 high sierra
body: <p>I am unable to do brew update because I can’t chown <code>/usr/local</code>:</p>
  
  <pre><code>$ brew update
  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
  </code></pre>
  
  <p>based on this: <a href="https://github.com/Homebrew/brew/issues/385" rel="noreferrer">https://github.com/Homebrew/brew/issues/385</a></p>
  
  <p>I tried these 2 chown command but it didnt work:</p>
  
  <pre><code>$ sudo chown -R $(whoami) $(brew --prefix)
  chown: /usr/local: Operation not permitted
  
  
  $ sudo chown -R $(whoami) /usr/local
  chown: /usr/local: Operation not permitted
  </code></pre>
  
  <p>Here is my <code>/usr/local</code> listing:</p>
  
  <pre><code>$ cd /usr/local
  $ ls -al
  total 56
  drwxr-xr-x 23 root wheel 736 Dec 2 15:24 .
  drwxr-xr-x@ 9 root wheel 288 Oct 26 00:22 ..
  -rw-r--r-- 1 megasap wheel 0 Dec 2 15:11 .com.apple.installer.keep
  drwxr-xr-x 16 megasap admin 512 Jan 11 14:08 .git
  drwxr-xr-x 5 megasap admin 160 Dec 2 15:24 .github
  -rw-r--r-- 1 megasap admin 1112 Aug 11 2016 .gitignore
  -rw-r--r-- 1 megasap admin 253 Aug 11 2016 .travis.yml
  -rw-r--r-- 1 megasap admin 291 Aug 11 2016 .yardopts
  -rw-r--r-- 1 megasap admin 3161 Aug 11 2016 CODEOFCONDUCT.md
  drwxr-xr-x 35 megasap admin 1120 Jan 11 11:35 Cellar
  -rw-r--r-- 1 megasap admin 1241 Jan 26 2016 LICENSE.txt
  drwxr-xr-x 9 megasap admin 288 Dec 2 15:25 Library
  -rw-r--r-- 1 megasap admin 5451 Aug 11 2016 README.md
  drwxr-xr-x 262 megasap admin 8384 Jan 11 23:09 bin
  drwxr-xr-x 11 megasap admin 352 Dec 2 15:25 etc
  drwxr-xr-x 57 megasap staff 1824 Dec 2 15:25 include
  drwxr-xr-x 102 megasap staff 3264 Dec 2 15:25 lib
  drwx------ 4 megasap wheel 128 Dec 2 15:24 libexec
  drwxr-xr-x 3 megasap admin 96 Dec 2 15:23 n
  drwxr-xr-x 34 megasap admin 1088 Dec 2 15:25 opt
  drwxr-xr-x 8 megasap admin 256 Dec 2 15:24 sbin
  drwxr-xr-x 16 megasap admin 512 Dec 2 15:25 share
  drwxr-xr-x 8 megasap admin 256 Dec 2 15:25 var
  </code></pre>
  
  <p>I'm using macOS 10.13.1 high sierra.</p>