10

I have a Homebrew cask installed which, when I attempt to uninstall it gives me an error:

$ brew cask uninstall julia
Error: Cask 'julia' definition is invalid: invalid 'depends_on macos' value: ":lion"

This leaves me unable to use brew to remove the files installed by the cask or undo the other changes the cask installation processes made.

How do I manually remove a cask, and reverse the ranges that were made when it was installed?


$ brew cask info julia
julia: 1.1.0
https://julialang.org/
/usr/local/Caskroom/julia/0.5.0 (64B)
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/julia.rb
==> Name
Julia
==> Artifacts
Julia-1.1.app (App)
/Applications/Julia-1.1.app/Contents/Resources/julia/bin/julia (Binary)

$ brew cask outdated julia
julia (0.5.0) != 1.1.0

brew cask reinstall julia
==> Satisfying dependencies
==> Downloading https://julialang-s3.julialang.org/bin/mac/x64/1.1/julia-1.1.0-mac64.dmg
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'julia'.
Error: Cask 'julia' definition is invalid: invalid 'depends_on macos' value: ":lion"
orome
  • 45,163
  • 57
  • 202
  • 418

2 Answers2

12

I had this problem, and was able to manage it by running the command in the first post at https://github.com/Homebrew/homebrew-cask/issues/58046 -- which is:

/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'

According to that post:

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

nachbar
  • 2,643
  • 1
  • 24
  • 34
3

Try updating it, cleaning it, then forcing the uninstall.

brew update

brew cleanup

rm -rf /opt/homebrew-cask/Caskroom/julia

You may need to use sudo to get the last one to work

Eliot
  • 5,450
  • 3
  • 32
  • 30
stuartjash
  • 181
  • 8