Error: Cask ‘inkscape’ definition is invalid: invalid depends_on key: ‘:x11’

Homebrew upgrade foiled again

Ran into this error while attempting a brew upgrade

...

==> Casks with ‘auto_updates’ or ‘version :latest’ will not be upgraded; pass ` — greedy` to upgrade them.
==> Upgrading 7 outdated packages:
Error: Cask ‘inkscape’ definition is invalid: invalid depends_on key: ‘:x11’

I attempted to remove Inkscape…

➜ ~ brew remove inkscape
Error: Cask ‘inkscape’ definition is invalid: invalid depends_on key: ‘:x11’

Well, crap.

It turns out there’s a line in one of the Ruby files that explicitly states:depends_on x11: true

➜ ~ find "$(brew --prefix)/Caskroom/"*'/.metadata' -type f -name '*.rb' -print0 | xargs -0 grep "depends_on x11"

/usr/local/Caskroom/inkscape/.metadata/0.92.2–1,11269/20190325002053.787/Casks/inkscape.rb: depends_on x11: true

We don’t have X11 so it’s safe to remove this line.

➜ ~ sed -I '' '/depends_on x11:/d' /usr/local/Caskroom/inkscape/.metadata/0.92.2–1,11269/20190325002053.787/Casks/inkscape.rb

After removing it, running brew upgrade completes without issue.

--

--