Learn how to easily remove the message "compinit:503: no such file or directory _brew_cask" that appears in your terminal.

How to remove the message in the terminal of MacOS BigSur: compinit:503: no such file or directory _brew_cask

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 ❤️!


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors