Change Your Mac's Time Zone from the Terminal

Set the system time zone by name — useful after travelling or when pre-configuring new Macs in a script.

macOSsystemsetuptimezonesettingsMedium risk
Run sudo systemsetup -settimezone "Asia/Shanghai" to switch the Mac to China Standard Time instantly.

01Command

Command
$ sudo systemsetup -settimezone "Asia/Shanghai" && sudo systemsetup -gettimezone

02What it does

The time zone argument must be a valid IANA zone name in Area/City form; wrong names are silently rejected, so run sudo systemsetup -listtimezones to find the exact string and -gettimezone to confirm the result. Because it goes through systemsetup, the same line works over SSH for fleets of machines.

03Risk

RiskMedium risk
RequirementsRequires an administrator password.
!Warning: If 'Set time zone automatically using current location' is on in System Settings, macOS may switch the zone back the next time it gets a location fix.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • systemsetup - Set System Configuration Preferences
    SS64 · technical · 2026-09-17
    Evidence: Documents -settimezone to set the current time zone (e.g. 'US/Pacific') and -gettimezone to display it.
  • About systemsetup in Remote Desktop
    Apple · vendor-doc · 2026-09-17
    Evidence: Apple's official Remote Desktop guide lists systemsetup commands including -settimezone for setting the current time zone and -gettimezone for viewing it.

Last verified: 2026-09-19 · Category: System & Settings

06Related solutions