Homebrew fix for Big Sur

If you get any of the warnings like below as an example..

`Warning: Unexpected method ‘gpg’ called on Cask mysqlworkbench.`
`Follow the instructions here:`
https://github.com/Homebrew/homebrew-cask#reporting-bugs
`Error: Cask ‘yed’ definition is invalid: invalid ‘depends_on macos’ value: unknown or unsupported macOS version: :mountain_lion`

If you get an error of the type Error: Cask 'hex-fiend-beta' definition is invalid: invalid 'depends_on macos' value: ":lion", where hex-fiend-beta can be any cask name, and :lion any macOS release name, run the following command:

/usr/bin/find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | /usr/bin/xargs -0 /usr/bin/perl -i -pe 's/depends_on macos: \[.*?\]//gsm;s/depends_on macos: .*//g'

This will remove all depends_on macos references of installed casks (where it doesn’t matter anymore anyway).

--

--

Shaun Stanislaus

An Entrepreneur/Technopreneur with a little knowledge of everything. Full-stack developer, SRE, DevOps execute ideas and pivot, bringing it to then next level.