Updating a Ruby file will fix this. This one took me a bit to find.
Error: Cask ‘wine-stable’ definition is invalid: invalid depends_on key: ‘:x11’
I’m getting this error whether I run
brew upgrade, brew install --caske wine-stable
or brew uninstall --cask wine-stable
.
I think the issue is that x11 is now deprecated and if you installed this version of wine, you can’t uninstall it until you tell this specific file that has the error, to no longer use that flag.
Run this command to figure out which file has the error you’re looking for:
find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | xargs -0 grep "depends_on x11"
This will tell you where the file is at:
- Open that file with an editor (e.g. nano or vs code in my case)
- Comment out the line that says
depends_on x11: true
- Save
Now run brew uninstall wine-stable
and then wine upgrade
and that should work
Source: