Please provide mac script to set time zone automatically based on the current device location. Script to set time zone published in the script repository doesn’t enable ‘set time automatically using current location’ checkbox in the date & time settings.
This script works on my M1 Mac running Big Sur 11.2.3 :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#!/bin/bash #enabling location services /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1 uuid=$(/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57) /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1 #configure automatic timezone /usr/bin/defaults write /Library/Preferences/com.apple.timezone.auto Active -bool YES /usr/bin/defaults write /private/var/db/timed/Library/Preferences/com.apple.timed.plist TMAutomaticTimeOnlyEnabled -bool YES /usr/bin/defaults write /private/var/db/timed/Library/Preferences/com.apple.timed.plist TMAutomaticTimeZoneEnabled -bool YES /usr/sbin/systemsetup -setusingnetworktime on /usr/sbin/systemsetup -gettimezone /usr/sbin/systemsetup -getnetworktimeserver |
21 February 2022