Homebrew gives me this error on macOS Monterey while using it:
Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins
How can I fix it?
EDIT: Permanent Solution from the JW's comment below:
sudo rm -r /usr/local/lib/docker/cli-plugins
Previous Solution
If you had recently deleted Docker, you have to manually recreate the Docker folder:
mkdir -p /Applications/Docker.app/Contents/Resources/cli-plugins
Then run
brew cleanup
You should have fixed the issue!
After that, you can delete the Docker application inside the Application folder
Source: https://flaviocopes.com/homebrew-fix-permission-denied-apply2files/