'How can I clear the CoreBluetooth cache on MacOS?

I'm developing a Bluetooth LE device and am having trouble because of MacOS's caching of the services. If I try to delete a service or change its UUID on the device I'm developing, the change doesn't show up on the Mac and instead I continue seeing the old list of services and UUIDs from the device. I tried going to another Mac that hadn't paired with my device and it saw the new list of services with the correct UUIDs, so it seems to be a caching issue with my development Mac.

I found the com.apple.Bluetooth.plist file in /Library/Preferences and deleted it, but the system put it back with the same data, I presume the system has the cache loaded into memory and is just writing it back out when needed.

Does anybody know how to wipe the MacOS CoreBluetooth device/service cache?



Solution 1:[1]

You can also clear the cache via the following command in the Terminal:

sudo rm /Library/Preferences/com.apple.Bluetooth.plist && sudo shutdown -r now

This does what John explained earlier; make sure you have no ongoing / unsaved processes taking place (since this command will restart your machine).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jinyoungch0i