This error is caused because Homebrew of the Macbook M1 is installed under the /opt/homebrew
directory, however, zsh assumes that it's under the /usr/local
directory. To solve this problem you may simply remove the symlinks manually using rm -rf <path-to-symlink>
or better yet, run a brew cleanup with the following command:
arch -x86_64 brew cleanup
Or if you have the issue but you aren't using an ARM processor, then use:
brew cleanup
After running the command, you will get an output similar to:
Pruned 1 symbolic links from /usr/local
So, when you launch a new instance of the terminal, the error won't appear anymore!
Happy coding ❤️!