How to add the wifi and bluetooth icon to the menubar programatically (from the command line)

-setupbluetoothcommand linemenu barwifi

We have a large number of computers to set up and would like to add the wifi and bluetooth icons to the menubar. How can I turn these settings on via a shell script or command line instruction?

Best Answer

I believe the Wi-Fi one is there by default, but if you want to be sure, you can use

open '/System/Library/CoreServices/Menu Extras/Bluetooth.menu'

open '/System/Library/CoreServices/Menu Extras/AirPort.menu'

to add them to the menu bar.

(Note: those paths are valid from at least El Capitan to Catalina.)