Since I couldn’t find an obvious search post for how to disable this easily (and remotely) I thought I’d write it up so that others can more easily
Firstly, the setup assistant is supposed to be helpful, particularly because Mac Minis particularly are o ften set up with a remote keyboard. Since all Macs have bluetooth enabled, allowing users to connect a keyboard automatically is a benefit for first-time setups.
Of course for remote or headless Macs, this can get in the way, particularly if you are testing UI code.
There’s an option in the Bluetooth settings in the System Preferences app that allows you to turn these options on or off:
Setting this is OK if you have a mouse connected (or via Remote Desktop), but if you have many macs (such as a test farm) to set up, this is not something that scales well.
Fortunately, the same thing can be done with a few lines of shell script:
Now, you’ll never see the Bluetooth Assistant popping up on your Mac again.