When upgrading my Node.js installation on macOS using Homebrew, I encountered a problem. After running brew upgrade node, Homebrew automatically executed brew cleanup. During this process, I noticed a series of removals: Removing: /Users/...... However, the process was interrupted with an error message:

Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins

Upon further investigation, I discovered that the error was related to Docker, which I had recently deleted. To resolve the issue, I recreated the Docker app folder by executing the following command:

mkdir -p /Applications/Docker.app/Contents/Resources/cli-plugins

Next, I ran brew cleanup again, and the problem was successfully resolved.

If you are experiencing a similar error, it may be caused by a different missing library rather than Docker. In such cases, it is recommended to search for the specific error message online and see if others have encountered and resolved the same issue. This can help you find alternative solutions or additional troubleshooting steps.

Tags: Homebrew error, permission denied, apply2files, Node.js installation, macOS, Homebrew, Docker, library missing, troubleshooting.