-
-
Save AndrewWCarson/d4e2e1e601b759c19553fec2310433e2 to your computer and use it in GitHub Desktop.
| #!/bin/bash | |
| # (C) Andrew Worth Carson | |
| # MIT License: https://andrewworthcarson.com/mit_license.html | |
| for user in $(dscl . list /Users UniqueID | awk '$2 >= 500 {print $1}'); do | |
| userHome=$(dscl . read /Users/"$user" NFSHomeDirectory | sed 's/NFSHomeDirectory://' | grep "/" | sed 's/^[ \t]*//') | |
| if [ "$(defaults read "${userHome}/Library/Preferences/com.apple.systemuiserver.plist" 2> /dev/null | grep -i user.menu)" == "" ]; then | |
| touch "${userHome}/Library/Preferences/com.apple.systemuiserver.plist" | |
| defaults write "${userHome}/Library/Preferences/com.apple.systemuiserver.plist" menuExtras -array-add '<string>/System/Library/CoreServices/Menu Extras/User.menu</string>' | |
| fi | |
| done | |
| defaults write /Library/Preferences/.GlobalPreferences MultipleSessionEnabled -bool Yes | |
| killall -HUP SystemUIServer |
I tried this snippet in my script at https://gist.github.com/ChristopherA/98628f8cd00c94f11ee6035d53b0d3c6
However, on execution in Monterey I get:
Could not write domain /Library/Preferences/.GlobalPreferences
My terminal already has full disk access permissions (tested near the top of my script.)
Any suggestions?
I've also tried sudo, which gets rid of the above error, however, the fast user switching icon does not show up after killall -HUP SystemUIServer.
@ChristopherA thanks for the info. I revisited this script briefly today and it seems like the .GlobalPreferences.plist no longer manages these settings on Monterey. I'm not sure when that changed as I haven't used this script in quite a while.
I'll need to do some digging in my off-time to figure out how they're managed. I'll update this script if I figure it out.
Updated user iteration.