Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I uninstall a Homebrew cask manually?

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"
like image 930
orome Avatar asked Feb 03 '23 18:02

orome


1 Answers

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).

like image 160
nachbar Avatar answered Apr 01 '23 09:04

nachbar