I know this is a frequently asked question, but I am really struggling.
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:
Error: Permission denied @ rb_sysopen - /usr/local/var/homebrew/locks/mysql.formula.lock
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.
So I tried uninstalling it with root, but it gave me this error:
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.
I looked at many articles, including this link! 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.
I tried to run:
sudo chown root /usr/local/bin/brew
But this did not work as well.
Is there any ways I can bypass this error, and run brew as root?