Spotify continues playing on my Mac when my bluetooth headphones are disconnected (when they go out of range or lose battery for example). I have an AppleScript to pause Spotify, and I want it to be run upon the bluetooth device disconnecting. How can I detect when the bluetooth headphones are disconnected?


1 Answer 1


system_profiler SPBluetoothDataType can check you bluetooth status.

There will be connection parameters Connected: Yes or No

  • is there a way to parse the output? I see list of information is showing, it doesn't look like an XML or JSON. Apr 16, 2022 at 13:28
  • Try the -xml or -json options
    – maephisto
    Jun 16, 2022 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .