mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-05 01:46:46 +01:00
Fix btrestart command for macOS Monterey 12.2.1+
- Replace deprecated kextunload/kextload approach with launchctl - Kill audio and bluetooth processes before restarting services - Use launchctl to restart bluetooth and audio services - Add error handling with 2>/dev/null || true for robustness - Fixes issue where kext is 'in use or retained' on modern macOS Resolves #10934
This commit is contained in:
parent
c6482fa5be
commit
cb932fe914
1 changed files with 11 additions and 2 deletions
|
|
@ -19,8 +19,17 @@ alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false &
|
|||
|
||||
# Bluetooth restart
|
||||
function btrestart() {
|
||||
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
|
||||
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
|
||||
# Kill audio and bluetooth processes
|
||||
pgrep audio | xargs sudo kill 2>/dev/null || true
|
||||
pgrep bluetooth | xargs sudo kill 2>/dev/null || true
|
||||
|
||||
# Restart bluetooth services using launchctl
|
||||
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl stop 2>/dev/null || true
|
||||
sudo launchctl list | grep -i blue | awk '{ print $3 }' | xargs sudo launchctl start 2>/dev/null || true
|
||||
|
||||
# Restart audio services using launchctl
|
||||
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl stop 2>/dev/null || true
|
||||
sudo launchctl list | grep -i audio | awk '{ print $3 }' | xargs sudo launchctl start 2>/dev/null || true
|
||||
}
|
||||
|
||||
function _omz_macos_get_frontmost_app() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue