Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot uninstall using brew on macOS 14.4 #727

Open
musse opened this issue Mar 18, 2024 · 10 comments · Fixed by Homebrew/homebrew-cask#169322
Open

Cannot uninstall using brew on macOS 14.4 #727

musse opened this issue Mar 18, 2024 · 10 comments · Fixed by Homebrew/homebrew-cask#169322
Labels

Comments

@musse
Copy link

musse commented Mar 18, 2024

Description of the bug
Cannot uninstall after install with brew on macOS 14.4:

brew uninstall background-music
==> Uninstalling Cask background-music
==> Removing launchctl service com.bearisdriving.BGM.XPCHelper
==> Uninstalling packages with sudo; the password may be necessary:
==> Removing files:
/Library/Application Support/Background Music
/Library/Audio/Plug-Ins/HAL/Background Music Device.driver
/usr/local/libexec/BGMXPCHelper.xpc
Could not kickstart service "com.apple.audio.coreaudiod": 1: Operation not permitted
Error: Failure while executing; `/usr/bin/sudo -E -- /bin/launchctl kickstart -kp system/com.apple.audio.coreaudiod` exited with 1. Here's the output:
Could not kickstart service "com.apple.audio.coreaudiod": 1: Operation not permitted

https://developer.apple.com/documentation/macos-release-notes/macos-14_4-release-notes#Core-Audio

To improve security and stability, using launchctl kickstart -k is no longer permitted for critical system processes. If a process must be forcefully terminated, it is recommended to use kill instead. (123028502)

Steps to reproduce

  1. Install with brew;
  2. Try to uninstall with brew.

Versions

Please complete the following information.

  • Background Music: 0.4.0
  • macOS: Sonoma 14.4
@musse musse added the bug label Mar 18, 2024
@musse musse changed the title Cannot uninstall Cannot uninstall using brew on macOS 14.4 Mar 18, 2024
@DamianPereira
Copy link

DamianPereira commented Mar 22, 2024

I see the PR to fix this in homebrew-cask is merged, but doing brew update does not seem to fix this issue, is anything else necessary?

@musse
Copy link
Author

musse commented Mar 23, 2024

@DamianPereira Even after the homebrew-cask fix was merged, there was a "cached" copy of the background-music.rb file (I don't remember the exact path), I had to manually edit it to match the fixed file to be able to uninstall it.

@DamianPereira
Copy link

Thank you! I'll check it out.

@gastonmorixe
Copy link

Similar issue, also happening with ExistentialAudio/BlackHole

$ brew uninstall -f background-music
==> Uninstalling Cask background-music
==> Removing launchctl service com.bearisdriving.BGM.XPCHelper
==> Uninstalling packages with sudo; the password may be necessary:
==> Removing files:
/Library/Application Support/Background Music
/Library/Audio/Plug-Ins/HAL/Background Music Device.driver
/usr/local/libexec/BGMXPCHelper.xpc
Could not kickstart service "com.apple.audio.coreaudiod": 1: Operation not permitted
Error: Failure while executing; `/usr/bin/sudo -E -- /bin/launchctl kickstart -kp system/com.apple.audio.coreaudiod` exited with 1. Here's the output:
Could not kickstart service "com.apple.audio.coreaudiod": 1: Operation not permitted


$ brew info background-music
==> background-music: 0.4.0
https://github.com/kyleneideck/BackgroundMusic
/opt/homebrew/Caskroom/background-music/0.4.0 (895KB)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/b/background-music.rb
==> Name
Background Music
==> Description
Audio utility
==> Artifacts
BackgroundMusic-0.4.0.pkg (Pkg)
==> Analytics
install: 2,133 (30 days), 7,116 (90 days), 23,090 (365 days)

@gastonmorixe
Copy link

ok manually editing /opt/homebrew/Caskroom/background-music/.metadata/0.4.0/20231226055056.585/Casks/background-music.rb with the patch did let me uninstall

@lead0r
Copy link

lead0r commented Apr 26, 2024

ok manually editing /opt/homebrew/Caskroom/background-music/.metadata/0.4.0/20231226055056.585/Casks/background-music.rb with the patch did let me uninstall

Can you help me with this? What exactly do I need to edit in this file? I'm just trying to update but that's not possible when I cannot uninstall

@kyleneideck
Copy link
Owner

@lead0r Is this what you're looking for? https://github.com/Homebrew/homebrew-cask/pull/169322/files

@lead0r
Copy link

lead0r commented Apr 26, 2024

@lead0r Is this what you're looking for? https://github.com/Homebrew/homebrew-cask/pull/169322/files

Yes, thank you, that worked!

@ibehnam
Copy link

ibehnam commented May 5, 2024

Can anyone please say how they managed to fix this issue? This is the formula on my Mac that is causing the problem:

cask "background-music" do
  version "0.4.3"
  sha256 "c1c48a37c83af44ce50bee68879856c96b2f6c97360ce461b1c7d653515be7fd"

  url "https://github.com/kyleneideck/BackgroundMusic/releases/download/v#{version}/BackgroundMusic-#{version}.pkg"
  name "Background Music"
  desc "Audio utility"
  homepage "https://github.com/kyleneideck/BackgroundMusic"

  livecheck do
    url :url
    strategy :github_latest
  end

  pkg "BackgroundMusic-#{version}.pkg"

  uninstall_postflight do
    system_command "/usr/bin/killall",
                   args:         ["coreaudiod"],
                   sudo:         true,
                   must_succeed: true
  end

  uninstall launchctl: "com.bearisdriving.BGM.XPCHelper",
            quit:      "com.bearisdriving.BGM.App",
            pkgutil:   "com.bearisdriving.BGM",
            delete:    [
              "/Library/Application Support/Background Music",
              "/Library/Audio/Plug-Ins/HAL/Background Music Device.driver",
              "/usr/local/libexec/BGMXPCHelper.xpc",
            ]

  zap trash: [
    "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist",
    "~/Library/Preferences/com.bearisdriving.BGM.App.plist",
  ]
end

I tried editing it to remove the lines @kyleneideck linked, but then the hash changes and brew won't use it.

Edit: GPT-4 helped! I followed suggestion #2 and it got rid of this app once and for all.

https://copilot.microsoft.com/sl/gqurj7eu7q0

@yinan-c
Copy link

yinan-c commented May 6, 2024

Thanks, followed suggestions by #727 (comment) and #727 (comment) worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants