13

I would really like to use a script to enable these things on macOS High Sierra, by using defaults. I know how to create the script in .bash_profile, as I will use a function for it, and then just run the function in the terminal. However, what I'm missing are the actual strings to enable the following:

  • Displaying of Bluetooth icon
  • Displaying of Volume icon
  • Displaying of battery percentage
  • Displaying of full date

Are any of these programmatically settable by using Defaults, and have they changed a great deal between 10.6-10.13?

Ok, based on what IconDeamon said in the comments section for this post, I was able to go and edit ~/Library/Preferences/com.apple.systemuiserver.plist and was able to see a list of menus that I have enabled.

However, this does not necessarily take me to the place I want to go to. Ideally, it'd be good to find a list and be able to solve this. I mean, okay, now, thanks to help on this forum, I know that the ones I wish to display are:

/System/Library/CoreServices/Menu Extras/Script Menu.menu

/System/Library/CoreServices/Menu Extras/RemoteDesktop.menu

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

/System/Library/CoreServices/Menu Extras/TimeMachine.menu

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

/System/Library/CoreServices/Menu Extras/TextInput.menu

/System/Library/CoreServices/Menu Extras/Battery.menu

/System/Library/CoreServices/Menu Extras/Volume.menu

/System/Library/CoreServices/Menu Extras/Clock.menu

and that the menu can have a _5 or a _3 at the end to signify where it should go. But..? It's not exactly a user-writable textfile I can just edit.

  • I'll presume you know how to set bash and script this and are looking for the keys (or someone to say on the record - no you can't do this) for a specific version of macOS. – bmike Nov 25 '17 at 21:34
  • yep. i'm running osx el capitan but the machine i'm looking to just type "defaults" in (my function name in .bash_profile) is going to be a high sierra. – esaruoho Nov 25 '17 at 22:03
  • 1
    Look in ~/Library/Preferences/com.apple.systemuiserver.plist. – IconDaemon Nov 25 '17 at 22:29
  • thanks @IconDaemon - now i have a list of what i tend to use. but i'm not sure how to use this info for writing on a brand new computer. also, the Battery.menu does not automatically seem to specify percentage. – esaruoho Nov 25 '17 at 23:52
  • The following command will show the Battery Percentage: defaults write com.apple.menuextra.battery ShowPercent YES; killall SystemUIServer – user3439894 Nov 26 '17 at 0:45
7

This defaults write command will enable several menu-bar icons, including Bluetooth.

defaults write com.apple.systemuiserver menuExtras -array "/System/Library/CoreServices/Menu Extras/AirPort.menu" "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" "/System/Library/CoreServices/Menu Extras/Clock.menu" "/System/Library/CoreServices/Menu Extras/Displays.menu" "/System/Library/CoreServices/Menu Extras/Volume.menu"

Changes will not take effect until you restart the SystemUIServer:
killall SystemUIServer

If you want to enable additional items, look in ~/Library/Preferences/com.apple.systemuiserver.plist to find the specific name of the menu extra you are seeking.

Note: If you attempt to enable a menu extra that you do not have on your machine, the command will get stuck in an endless loop. Some users may not have the Eject.menu, for example.

  • I'm getting an endless loop of 2018-09-25 00:31:35.052 defaults[48638:10853265] Rep argument is not a dictionary Defaults have not been changed. 2018-09-25 00:31:35.973 defaults[48677:10853403] Rep argument is not a dictionary Defaults have not been changed. 2018-09-25 00:31:36.892 defaults[48715:10853535] Rep argument is not a dictionary Defaults have not been changed. 2018-09-25 00:31:37.807 defaults[48753:10853666] Rep argument is not a dictionary Defaults have not been changed. with macOS High Sierra. What am I doing wrong? – esaruoho Sep 25 '18 at 7:32
  • 2
    @esaruoho The command needs to be one line -- if you have extra carriage returns or blank lines in there, that might cause an issue like the one you mentioned. – Wade Williams Sep 25 '18 at 18:28
  • I did paste it as one line and got those errors. – esaruoho Sep 26 '18 at 0:17
  • 2
    Hi, after removing Eject, I was able to get them all to work. Eject.menu was creating this endless loop :) – esaruoho Nov 19 '18 at 8:00
  • For me, the Clock item would always reappear in the defaults after running killall – felixfbecker Jul 21 at 16:09

You must log in to answer this question.

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