mac Error: Running Homebrew as root is extremely dangerous and no longer supported

created at 07-24-2021 views: 1368

Use sudo brew install ffmpeg got error:

Error message

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.

The reason is because mac 10.13.6 and above does not allow homebrew to use the root user to install.

However, when some packages are installed using brew, it prompts insufficient permissions.

Solution

$ sudo chown -R `whoami` /usr/local/Homebrew/
$ sudo chown -R $(whoami) $(brew --prefix)/*
$ sudo mkdir /usr/local/Frameworks
$ sudo chown -R `whoami` /usr/local/Frameworks/
created at:07-24-2021
edited at: 06-23-2022: