Skip to content

Instantly share code, notes, and snippets.

@oleiade
Created February 23, 2016 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oleiade/5cafdf715d9b2743e545 to your computer and use it in GitHub Desktop.
Save oleiade/5cafdf715d9b2743e545 to your computer and use it in GitHub Desktop.
Properly configure audio over bluetooth for osx
#!/bin/sh
# Reconfigure bluetooth audio driver
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80
# Restart bluetooth daemon
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
# Prioritize audio/bluetooth processes
list="$(
sudo ps -A \
| grep -iE '([h]ear|[f]irefox|[b]lue|[c]oreaudiod)' \
| cut -c 1-90
)"
pids=$( cut -c 1-6 <<< "$list" )
echo sudo renice -5 $pids
sudo renice -5 $pids
# Ask the user to restart the system
while true; do
read -p "It is recommended to restart the system after running this script. Restart [y/n]?" yn
case $yn in
[Yy]* ) sudo shutdown -r now "Rebooting"; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
@clnhll
Copy link

clnhll commented Feb 3, 2017

ahhh uhhhh how can I undo this? My bluetooth audio doesn't work at all anymore. I deleted the com.apple.BluetoothAudioAgent.plist file to clear the defaults but I guess the process prioritization messed it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment