MacOS – Homebrew uninstalling fails

applescriptcommand linehomebrewmacos

I am trying to uninstall a cask using homebrew, but each time it fails due to (I believe) AppleScript failing to run. I believe this issue stems from my multiuser setup (I am a non admin).

Error: Failure while executing; `osascript -e tell\ application\ \"System\ Events\"\ to\ delete\ every\ login\ item\ whose\ name\ is\ \"CleanMyMac\ 4\ Menu\"` exited with 1. Here's the output:
36:93: execution error: System Events got an error: AppleEvent timed out. (-1712)

Any help would be greatly appreciated! I am just trying to remove a cask from my computer and not have homebrew still think it is installed and try to update it every blue moon. If I have to remove it manually and update homebrew manually, so be it.

Best Answer

https://github.com/Homebrew/homebrew-cask/issues/50413

The solution was described as going to: /usr/local/Caskroom/CASKNAME/.metadata/CASKVERSION/WEIRDIDENTIFIER/Casks/CASKNAME.rb

And then from there I can remove the line that attempts to remove the login item. Then it uninstalls successfully and I can manually remove the login item.