Last active
August 5, 2023 05:58
-
-
Save ushuz/4f8c2771b295330b23154acfc00795b3 to your computer and use it in GitHub Desktop.
Fix macOS global "Country" setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# view gloabl prefs in json | |
# plutil -convert json -o - -- /Library/Preferences/.GlobalPreferences.plist | python -m json.tool | |
import CoreFoundation as cf | |
# get current Country | |
cf.CFPreferencesCopyValue('Country', cf.kCFPreferencesAnyApplication, cf.kCFPreferencesAnyUser, cf.kCFPreferencesAnyHost) | |
# set Country | |
cf.CFPreferencesSetValue('Country', 'TW', cf.kCFPreferencesAnyApplication, cf.kCFPreferencesAnyUser, cf.kCFPreferencesAnyHost) | |
# persist changes | |
cf.CFPreferencesSynchronize(cf.kCFPreferencesAnyApplication, cf.kCFPreferencesAnyUser, cf.kCFPreferencesAnyHost) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# it's a lot easier to use 'defaults' to change the global .plist | |
# | |
# credit: @ShallJaiden in comments | |
# | |
sudo defaults write /Library/Preferences/.GlobalPreferences.plist Country -string "TW" |
this doesn't work for me. I just simply run sudo defaults write /Library/Preferences/.GlobalPreferences.plist Country -string "TW"
that works for me
this doesn't work for me. I just simply run sudo defaults write /Library/Preferences/.GlobalPreferences.plist Country -string "TW"
that works for me
Thanks for sharing, that's far better. I'll incorporate it into the script for future visitors.
Thank you. This has fixed the problem that bothers me for a long time!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Or, you can always use
/usr/bin/python