Big Sur - Bluetooth.menu no longer exists

arlogilbert
New Contributor II

We have a set of scripts that keep all devices CIS compliant.

On Catalina this snippet ensured the bluetooth menu was visible.

#!/bin/bash
#CIS 2.1.3 enable bluetooth menu bar
if [[ "$loggedInUser" != "root" ]] && [[ "$loggedInUID" -ne 0 ]]; then
    btMenuBar="$(defaults read /Users/"$loggedInUser"/Library/Preferences/com.apple.systemuiserver menuExtras | grep -c Bluetooth.menu)"
    if [ "$btMenuBar" = "0" ]; then
        sudo -u $loggedInUser open "/System/Library/CoreServices/Menu Extras/Bluetooth.menu"
    fi
fi

Post Big Sur upgrade the /System/Library/CoreServices/Menu Extras/Bluetooth.menu file no longer exists and although I do see a bluetooth menu item on my screen, I can not for the life of me figure out how to open it from the command line.

Any suggestions?

14 REPLIES 14

mm2270
Legendary Contributor III

I haven't been able to test anything yet, but a user named @mikelaundrie posted on another thread that some of the missing menu bar items might now exist in the com.apple.controlcenter.plist file. See here:
https://www.jamf.com/jamf-nation/discussions/10576/menu-bar-customization#responseChild209331

LangStefan
New Contributor III

I saw the same in our environment. I guess it's because of the new control center. There is a plist file called com.apple.controlcenter in the same folder. You will have the same issue with the Wi-Fi symbol and the CIS 4.2
Edit: There was someone faster than me :) I tested it, but it is still not working for me.

joebesser
New Contributor

Diving a little deeper it looks like modifying the ~/Library/Preferences/ByHosts preference for the control center seems to do the trick. I'm a bit concerned that there might be more to these integer values than meets the eye, but it's worth testing, so I wanted to put it out there. Here's the code to show bluetooth in the menu bar

defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter.plist Bluetooth -int 18

Changing the int to 24 will hide it. Changing it to 1 will also hide it. changing it to 2 will also show it. Please give it a whirl and let me know how it works for you.

Cayde-6
Release Candidate Programs Tester

Thought I was going mad!!! Nothing showed on Google searches

Cayde-6
Release Candidate Programs Tester

This no longer seems to work again

Script result: 2020-12-14 17:09:14.422 defaults[2040:13293] 
The domain/default pair of (/Users/lewis/Library/Preferences/ByHost/com.apple.controlcenter.plist, Bluetooth) does not exist

cbutcher
New Contributor III

As some others have mentioned, this can now be found in the com.apple.controlcenter plist. I have also confirmed that Wifi and Volume also work in this plist.

Cayde-6
Release Candidate Programs Tester

@cbutcher My post clearly shows I was referring to com.apple.controlcenter.plist :)

Disable Bluetooth

sudo -u ${loggedInUser} defaults write /Users/${loggedInUser}/Library/Preferences/ByHost/com.apple.controlcenter.plist Bluetooth -int 18

Script result: 2020-12-14 17:09:14.422 defaults[2040:13293] The domain/default pair of (/Users/lewis/Library/Preferences/ByHost/com.apple.controlcenter.plist, Bluetooth) does not exist

agagnon
New Contributor

This is working for me, running this script in self service.

currentUser=$( ls -l /dev/console | awk '{print $3}' )
sudo -u ${currentUser} defaults write /Users/${currentUser}/Library/Preferences/ByHost/com.apple.controlcenter.plist Bluetooth -int 18
exit 0

apatel
New Contributor

@agagnon is this script still working for you? I tried it and Bluetooth icon is still in control center.

Tried @joebesser command suggestion but that did not work for me either.

Anyone else got something working to remove icons from Control Center or the entire control center icon from the menu bar itself?

Cayde-6
Release Candidate Programs Tester

@apatel The script works for me but it needs a restart before it takes effect.

TomRWSmith
New Contributor III

I've managed to use @agagnon code for the Bluetooth icon on the Menu Bar in Big Sur, which works fine for me.

Does anyone know how to show the battery percentage on the Menu Bar in Big Sur via a script? I've got the below script for Catalina however this doesn't work with Big Sur.

currentUser=`ls -l /dev/console | cut -d " " -f4`
sudo -u $currentUser defaults write com.apple.menuextra.battery ShowPercent YES
sudo -u $currentUser killall SystemUIServer

GabeShack
Valued Contributor III

@Tomsmithdrpg This command enables the battery percent without the need to run the kill all. Seems to just work instantly:

~/Library/Preferences/ByHost/com.apple.controlcenter.plist BatteryShowPercentage -bool true

Gabe Shackney
Princeton Public Schools

Gabe Shackney
Princeton Public Schools

TomRWSmith
New Contributor III

Sorry for hijacking the post again but managed to get the Battery Percentage to finally show on the Menu Bar in Big Sur. Thanks @gshackney for your help I managed to put something together from few different sources and using your suggestion above.

Hopefully, this helps someone else out in the future, ran as a once per computer script for Big Sur devices.

#!/bin/bash

_user=`who | grep console | awk '{ print $1 }'`

sudo -u $_user defaults write /Users/$_user/Library/Preferences/ByHost/com.apple.controlcenter.plist BatteryShowPercentage -bool true

Raj_Jenkin
New Contributor III

Thank You! 

 

Raj_Jenkin_0-1630507316579.png