If you’re a Mac developer, you’re surely familiar with Homebrew, and you’ve probably used brew-cask to install apps. Today, when I tried to install a program with brew cask, I kept getting the error “Error: Unknown command: cask” every time I ran brew cask install xxx, even though I had confirmed that brew cask was installed successfully. After searching the issues, I learned that this seems to be a bug in an older version, which has since been fixed.

For details, see Bug report: “Error: Unknown command: cask”

In short, if you keep seeing “Error: Unknown command: cask” after running brew update, run the following command. It updates Homebrew to the latest state, which should solve the problem!

Of course, first make sure you didn’t simply forget to install brew-cask (lol).

cd $(brew --repo); git fetch; git reset --hard origin/master; brew update

If you want to install brew cask, run the following command:

brew tap caskroom/cask