Hello,
I would like to change the system timezone in macOS, given a timezone identifier in the IANA timezone database.
- is 'systemsetup -settimezone' the only available tool or API that can be used to change the timezone?
I have observed that TimeZone(identifier:) can initialize a TimeZone from any identifier in the tz database, but many identifiers are missing from the list accepted by systemsetup.
For example, if the user has set the timezone to "Mumbai - India" in system settings, the timezone identifier returned by 'systemsetup -gettimezone' is Asia/Kolkata, which is not in the list printed by 'systemsetup -listtimezones'.
- What is the recommended way to map a IANA timezone name (or a TimeZone object) to one of the timezone names accepted by 'systemsetup'?
There isn’t an API to change the system time zone. If you’d like to see that change, I encourage you to file an enhancement request that outlines what you want to do and why. And if you do file an ER, please post your bug number, just for the record.
Regarding the systemsetup tool, that tool is aimed at system admins. It’s not intended to be a substitute for an API. You can attempt to use it as such, but in my experience such attempts are usually less than satisfactory.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"