macOS doesn't provide a built-in way to set the Bluetooth audio codec, but this can be done using a free tool from Apple called Bluetooth Explorer. The tool is available in the Downloads section of the Apple Developer website as part of the "Additional Tools for Xcode 8.2" package. (You'll need to log in with a free account.) You can find Bluetooth Explorer in the Hardware directory of the disk image Apple provides. Once you've started the app, click on Tools Audio Options in the menu bar. This will open a window that provides various options for enabling and disabling codecs and adjusting other audio settings. I was able to resolve a problem with low-quality audio from a Bluetooth headset by selecting the "Force use of aptX" and "Disable Handsfree profile" options.