Fix installer failing in macOS 14.5.

`launchctl kickstart -k` is no longer permitted for `coreaudiod`. See
<https://developer.apple.com/documentation/macos-release-notes/macos-14_4-release-notes>.
(Thanks to @gchilds.)

As explained in those release notes, `kill` still works. `postinstall`
was using `killall coreaudiod` if `launchctl kickstart -k` failed, but
that was failing as well because it had to be `sudo killall coreaudiod`.

I haven't been able to reproduce this on macOS 14.4, only 14.5. Not sure
why.

See #705.
This commit is contained in:
Kyle Neideck 2024-04-23 15:46:05 +10:00
parent 73f221e423
commit 3097f4b621
No known key found for this signature in database
GPG key ID: CAA8D9B8E39EC18C
3 changed files with 14 additions and 12 deletions

View file

@ -38,12 +38,13 @@
(Audio will stop working until the next step, so you might want to pause any running audio apps.) (Audio will stop working until the next step, so you might want to pause any running audio apps.)
```shell ```shell
sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod sudo killall coreaudiod
``` ```
or, if that fails or, if that fails
```shell ```shell
sudo killall coreaudiod sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod
``` ```
- Run `Background Music.app`. - Run `Background Music.app`.

View file

@ -9,12 +9,12 @@
<sup>(Open `/Applications/Utilities/Terminal.app` and paste the following at the prompt.)</sup> <sup>(Open `/Applications/Utilities/Terminal.app` and paste the following at the prompt.)</sup>
```shell ```shell
sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod sudo killall coreaudiod
``` ```
or, if that fails or, if that fails
```shell ```shell
sudo killall coreaudiod sudo launchctl kickstart -kp system/com.apple.audio.coreaudiod
``` ```
- Go to the Sound section in System Settings and change your default output device at least once. (If you only have - Go to the Sound section in System Settings and change your default output device at least once. (If you only have
one device now, either use `Audio MIDI Setup.app` to create a temporary aggregate device, restart any audio apps that one device now, either use `Audio MIDI Setup.app` to create a temporary aggregate device, restart any audio apps that

17
pkg/postinstall Executable file → Normal file
View file

@ -19,7 +19,7 @@
# #
# postinstall # postinstall
# #
# Copyright © 2017-2022 Kyle Neideck # Copyright © 2017-2022, 2024 Kyle Neideck
# #
# Make sure we use the built-in versions of programs, for consistency. Probably not necessary # Make sure we use the built-in versions of programs, for consistency. Probably not necessary
@ -53,13 +53,14 @@ bash "post_install.sh" "$xpc_helper_install_path" "BGMXPCHelper.xpc/Contents/Mac
# some of these commands don't work with older versions of launchctl, so I figure there's no # some of these commands don't work with older versions of launchctl, so I figure there's no
# harm in trying a bunch of different ways (which should all work). # harm in trying a bunch of different ways (which should all work).
(sudo launchctl kickstart -k system/com.apple.audio.coreaudiod &>/dev/null || \ (sudo launchctl kickstart -k system/com.apple.audio.coreaudiod &>/dev/null || \
launchctl kill SIGTERM system/com.apple.audio.coreaudiod &>/dev/null || \ sudo launchctl kill SIGTERM system/com.apple.audio.coreaudiod &>/dev/null || \
launchctl kill TERM system/com.apple.audio.coreaudiod &>/dev/null || \ sudo launchctl kill TERM system/com.apple.audio.coreaudiod &>/dev/null || \
launchctl kill 15 system/com.apple.audio.coreaudiod &>/dev/null || \ sudo launchctl kill 15 system/com.apple.audio.coreaudiod &>/dev/null || \
launchctl kill -15 system/com.apple.audio.coreaudiod &>/dev/null || \ sudo launchctl kill -15 system/com.apple.audio.coreaudiod &>/dev/null || \
(launchctl unload "$coreaudiod_plist" &>/dev/null && \ sudo killall coreaudiod &>/dev/null || \
launchctl load "$coreaudiod_plist" &>/dev/null) || \ (sudo launchctl unload "$coreaudiod_plist" &>/dev/null && \
killall coreaudiod &>/dev/null) && \ sudo launchctl load "$coreaudiod_plist" &>/dev/null)
) && \
sleep 2 sleep 2
# Wait until coreaudiod has restarted and BGMDevice is ready to use. # Wait until coreaudiod has restarted and BGMDevice is ready to use.