How to Change Date and Time on Mac Using Terminal

The date and time on your Mac is not something that we often think about. Actually, most users leave their Mac on the default automatic setting it so it’s not something that we normally worry about. But there are situations where you might need to do this.

While it can be done through the Time and Date section in your desktop settings, some may want to change using Mac Terminal. Doing it through the terminal application is quite easy and can be done in just a few steps.

My name is Eric and as a Software Engineer, I perform tasks like this on a daily basis.  And I am still learning new things all the time. I love to do research on topics like this and I also enjoy learning from all the other users and readers out there.

If you want to learn about changing the date and time using Mac Terminal, keep reading and I will show you what I have learned.

Guide to Changing Date and Time on Mac via Terminal

Note: Using the sudo command before each of these commands will often require you to enter your password. This should be the password for the admin account you are using.

Step 1: Open Mac Terminal

Step 2: Turn off the setusingnetworktime feature

Turn off setusingnetworktime by typing the following command into the Terminal: 

sudo systemsetup -setusingnetworktime off

Step 3: Figure out your date/time parameter 

Determine your date and time parameter using the format [MM][DD][HH][MM][YY]

Example: April 15, 2022, 11:00 am would be 0415110022

Note: The time uses a 24-hour format.

Step 4: Use the date command to set the date and time.

Type the following command into your Mac Terminal to set the date and time. 

sudo date [MM][DD][HH][MM][YY]

Using our example: sudo date 0415110022

Step 4: Verify the time was set

Type just the “date” command alone to verify the time was properly set. 


How to Change the Timezone on Mac Terminal

Setting the timezone from Mac Terminal is just as easy as setting the date and time. You will first want to list the timezones so that you can find yours. If you want to set timezone to UTC, you won’t find UTC there. Remember that UTC is a standard, not a timezone.

GMT is the timezone that is the same time as UTC so if that is what you are looking for you can use GMT. All the other timezones are based on UTC and adjusted for their location around the world. 

Just follow the steps below to set your timezone.

Step 1: View the List of Timezones

Use the systemsetup -listtimezones to see the list of valid timeszones you can set. 

The list is quite long so you will want to use | more at the end of the command to keep them from all scrolling through the screen. 

systemsetup -listtimezones | more

Just hit the space bar to move through the list.

Step 2: Set the time zone 

Type sudo systemsetup -settimezone [your time zone], “your time zone is the name of the time zone you choose from the list in step 1. 

We will use Denver, CO, USA for this example:

sudo systemsetup -settimezone America/Denver

Step 3: Verify the time zone has been set

Type the following command into the Terminal and hit enter to verify your time zone was correctly set. The terminal will output “Time Zone:” followed by its current time zone setting. 

sudo systemsetup -gettimezone 


We get lots of questions about Mac settings, here are the most frequent ones related to date and time. 

Why are the date and time wrong on my Mac?

There are a number of reasons the date and time on your Mac may be wrong. In most cases, it is that you don’t have the setting enabled to automatically set the time. 

This can also happen with a Mac that does not have internet access and cannot connect to which sets the time.

Why won’t my Mac let me change the date and time?

To change the date and time, you must have administrative permissions on your Mac. You will also need to make sure that the setusingnetwroktime feature is turned off or you will not be able to change it.

You can check this by typing sudo systemsetup -getusingnetworktime into the Mac Terminal. The command sudo systemsetup -setusingnetworktime off should turn it off. 

How do I change the date format on my Mac?

You can change it from your desktop by going to System Preferences and then Language & Region. From there click on the Advanced button.

You will see a Dates tab which will allow you to specify the date format you see on your desktop and other places.

Final Words

Setting the date and time from Mac Terminal is fairly simple. Just keep in mind that you need to know the password for your admin account and you need to turn off the automatic time and date setting. I hope the information above can help you to set your time and date.

As usual, please let me know if you have any questions or comments. I would love to hear from you.

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Michael

    Hello Eric,
    I was pleasantly surprise with your article about using the terminal for changing time zone, automatically set the time etc.
    My iMAC model, from 2010, was 100% deleted and now am trying to return the computer to working condition.
    I am using macOS Utility, select Reinstall macOS and after a while this note appeared: “The recovery server could not be contacted”.
    One of many suggestions from the Internet was to involve DATE by Terminal.
    Do you have any advice as to how it would be possible to install macOS? (in my case it is High Sierra).

    • Eric

      Thank you Michael! I hope you enjoyed the article. I am sorry to hear you are having this issue. I know that it can be difficult to restore some systems from older macOS versions. I have heard of many issues doing this but I have heard that you need to set the date back to an earlier time. I’m not sure how far back you need to set it or if this really even works as I don’t currently have a system that I can try this with. In any case, you can open up a terminal session in recovery mode and once there, you can use the steps that I show above to set your date back to some previous date that may get it to work.. I think in one of the posts below, someone may have suggested setting it to 2013. Good luck! I hope that you are able to get this to work.

  • Mike

    Dear Eric,
    I have spent over 2 hours trying to input all of the actions recommended in your very informative article but without success.
    I am currently trying to carry out an internet recovery of my iMac OS (Intel). I go to macOS Utilities and when I took the “Reinstall macOS” option it took me to an installation of macOS High Sierra. I was ok with this but when I clicked on “Continue” i got a message “The recovery server could not be contacted”.
    I then went on to “Terminal” to check if there was any conflict on date or time. The date was correct but the time zone was on UTC. I am in Kenya, East Africa with a time zone difference of +3 hours. I have tried your instructions on how to change the time zone over and over again but i keep getting the same message on `terminal i.e. “command not found”.
    Is the UTC timezone causing a problem with the recovery server? If yes, do you any suggestion as to how I can resolve the problem. If “no” any other suggestions or advice? I am completely stuck and need to get my mac back to work.

    • Eric

      Hi Mike,
      I’m sorry to hear you are having this issue. Usually a “command not found” message means 1 of 3 things. Either the PATH variable is not set, the file is not there or there is a typo in the command. I know that when I first wrote this article there was a typo in the original command. I’m not sure when you tried it but you might want to verify that first. If the command is correct, you could try running it with the full path as shown below.

      /usr/sbin/systemsetup -settimezone

      This will run the command even if your PATH is not set. If that does not work try checking to see if the command is there by running the following ls command.

      ls /usr/sbin

      This should give you a list of files and you should see the systemsetup command there. If you see a file not found or a directory not found, it means the command may be located somewhere else on your system or it does not exist for whatever reason. You can try running the following command to see if it exists somewhere else.

      find / -name systemsetup 2>/dev/null

      That may take a few minutes to run, but if it comes back with results, try running the command using the full path that it shows in the results. Just copy and paste it and then add the -settimezone .

      If this does not work, it is possible that the command is not on the system for some reason. In that case, I don’t know of any way to set the time.

      I’m not sure if and how this will affect trying to reinstall an older version of macOS but it might be worth a try. Good luck and I hope that this information can help you with your issue.

    • Hope

      Eg installing an old Mac OS maybe High sierra, you need to do a back date.
      Eg 1104062013
      Month day hour minute year
      November fourth six twenty 2013.
      But before typing this 1104062013
      Type date first and space at the beginning of the numbers
      Under terminal page
      date 1104062013


      • Gaminghorde

        I change time but now show me UNTRUSTED_CERT_TITLE. To correct that i must change to the correct time but when i do this gives me the installation error at the end.

  • Robert

    Thanks for the article, it’s very helpful. However, there a typo under the heading “Why won’t my Mac let me change the date and time?”

    The following command is missing an “s” in “sytemsetup”: “You can check this by typing sudo sytemsetup -getusingnetworktime into the Mac Terminal.”

    • Eric

      Hi Robert,
      You’re welcome! I am glad that this was able to help you. Thanks so much for finding the typo. This is an important one to get corrected since it is actually in the command and the command won’t work properly with the typo. I really appreciate the feedback and that you found this. We will try to get this updated as soon as possible. Thanks again!

  • Qanit

    i got macbook 2010 i have no os installed in it just recovery of os x lion it won’t install. with following error “couldn’t install additonal files” i think it is because certificates are not up to date from apple servers that is why i need to change date put old date. remember no OS installed just doing revovery via cmd+R so pls tell me about it.

    • Eric

      Hi Qanit,
      Sorry to hear you are getting this error. This is a tough situation as I know it can be difficult working with older os versions and it is sometimes hard to get support. I have never tried this before, but you could try opening a terminal session in recovery mode and then use the commands I have shown above to set the date. I’m not sure if that will work but is something you could try.

  • Stas

    Hi Eric.
    Need a help. What about non standard UTC time? I am a Seaman we often cross Pacific and we shift clock every second day. I really have no idea which city has for example UTC+11, or UtC-12, or UTC+6 (we usually have that time in Indian Ocean, yes we have that kind a time onboard, timezones Like GMT-8( Singapore, China) or -9 (Korea, Japan), Panama, Houston, London, central European time, Dubai, Qatar are well known, but what about “transit’ time?, Having android phones is not a problem, because there is a chance of choose time by UTC difference, not by city. But Mac, as usually, has it’s own way… help me to change timezone not by cities.

    • Eric

      Hi Stas,
      I can see how this can be very frustrating. I know how to set the time zone on a Mac but I am definitely not an expert on time zones or how they are set up. This sounds like a difficult problem. The only thing that I can think of is to find some kind of a reference that tells you cities that are near the UTC time zone you are in. I did find a reference on Wikipedia as shown below but I don’t know how accurate it is or if it can help.

      I hope that this can provide some kind of help for you and that you can figure out a good way to set your clock. Good luck and thank you for the question.

  • Gavin

    Hi Eric,

    I am thinking to change my macbook to follow the 30 hour time format, any idea how I can do that?
    Thank you.

    • Eric

      Hi Gavin,
      I am not familiar with the 30 hour time format. I do not know of any way to set your MacBook for that but if you find something let me know, I would love to hear about it.

  • Sebas

    Hi Eric,

    I did reset my MacBook and i don’t have any user or password so my command in the terminal start as -bash-3.2# what is the command to change the time zones from PST to GMT ?? Because i have an error so i cant reinstall it, i did change my time and date and i try some command for the time zones but it says ”command not found”

    thanks in advance

    • Eric

      Hi Sebas,
      Basically the command should be as shown below:

      systemsetup -settimezone GMT

      It looks like you are logged in as root, but if not you will need to use sudo in front of the command like this:

      sudo systemsetup -settimezone GMT

      You will not be able to do this unless you have admin permissions and a password. Do you have an admin login for your MacBook? If you still cannot get this to work, you may want to try doing it from your desktop. Good luck! I hope this information can help.

  • Mario

    Hi Eric,

    Quick question: is there a way to just change the date without having to change or enter the time?

    Thanks very much!

    • Eric

      Hi Mario, this is a great question. I have done a little research on this and I don’t see a way to change just the date. When I get a chance, I will take a more in depth look and see if I can figure out a way to do this.

  • Mike

    One small detail I noticed while looking through this is that the command for listing the time zones should have an “s” on the end. So I ran sudo systemsetup -listtimezones

    • Eric

      Hi Mike,
      Great catch! You are correct it should be -listtimezones with an s at the end. I really appreciate your feedback. We will get this updated as soon as possible to make sure that the information is accurate. Thank you very much!