title: How can I run brew as root?
body: <p>I know this is a frequently asked question, but I am really struggling.</p>
  
  <p>I have recently tried to install MySQL with Homebrew on my Mac OS El-Capitan. However, I have encountered some problems with it and I want to reinstall it.  Yet whenever I try doing that it gives me:</p>
  
  <pre><code>Error: Permission denied @ rb_sysopen - /usr/local/var/homebrew/locks/mysql.formula.lock
  </code></pre>
  
  <p>I tried to bypass this error by simply sorting the named files out manually in the root account, but there were way too many files.</p>
  
  <p>So I tried uninstalling it with root, but it gave me this error:</p>
  
  <pre><code>Error: Running Homebrew as root is extremely dangerous and no longer supported.
  As Homebrew does not drop privileges on installation you would be giving all
  build scripts full access to your system.
  </code></pre>
  
  <p>I looked at many articles, including this <a href="http://www.example.com/" rel="nofollow noreferrer">link</a>!  Many of them suggested that I chown the /usr/local folder directly to my own user account with root, so I can run brew without any permission problems, but it is too dangerous.</p>
  
  <p>I tried to run:</p>
  
  <pre><code>sudo chown root /usr/local/bin/brew
  </code></pre>
  
  <p>But this did not work as well.</p>
  
  <p>Is there any ways I can bypass this error, and run brew as root?</p>