Mac os terminal set date

Установите системное время в Mac OS X из командной строки 2021

Mac OS X Welcome Videos

  • Mac OS X Welcome Videos

    Часы в Mac OS X устанавливаются автоматически по умолчанию, но если вы хотите установить точное время или ищете решение для командной строки, чтобы установить системное время, вы можете сделать это с помощью инструмента ntpdate или стандартной даты. команда.

    Установите системную дату в Mac OS X из командной строки с центральным сервером времени

    Для ntpdate, который устанавливает дату и время на основе времени с центрального сервера, доступ к которому осуществляется через Интернет, вы можете указать его либо на серверах времени Apple, либо на pool.ntp.org, чтобы получить точное время:

    sudo ntpdate -u time.apple.com

    При появлении запроса введите пароль администратора, и вскоре вы увидите что-то вроде следующего:

    4 Jul 14:30:11 ntpdate: adjust time server 17.151.16.14 offset 0.000336 sec

    Смещение в конце позволяет узнать, насколько отличались системные часы от вновь установленного времени. В этом примере системные часы были отключены на смехотворно малую долю секунды.

    Как правило, вам не нужно делать это, если вы используете функцию «Установить дату и время автоматически» в системных настройках «Дата и время», хотя, устанавливая часы в командной строке, вы можете быть уверены, что на каждом компьютере в сети отображается точное в то же время.

    Установите системную дату Mac вручную с помощью команды терминала

    Другой подход состоит в том, чтобы установить дату вручную из командной строки, используя командную строку «date», где date в формате ЧЧ] MM, то есть месяц Date Hour Minute Year без разделения. Это выглядит примерно так:

    Для этого примера будет установлена ​​дата «12 июля 2018 года в 12:23».

    Вы можете узнать больше об установке даты с помощью даты –help, которая также указывает, что вы можете даже установить секунды, если хотите.

    Трюк с датой — это то, что вы хотели бы использовать, если у рассматриваемого Mac нет доступа в Интернет по той или иной причине.

    Источник

    Set the System Time in Mac OS X from the Command Line

    The clock in Mac OS X sets itself automatically by default, but if you want to set the precise time or are looking for a command line solution to set system time, you can do so with a tool called ntpdate, or the standard ‘date’ command.

    Set System Date in Mac OS X from Command Line with a Central Time Server

    For ntpdate, which sets the date and time based on the time from a central server accessed via the internet, you’d want to point it either at Apple’s time servers or pool.ntp.org as follows to get the exact time:

    sudo ntpdate -u time.apple.com

    Enter the admin password when asked, and you’ll soon see something like the following:

    4 Jul 14:30:11 ntpdate[28267]: adjust time server 17.151.16.14 offset 0.000336 sec

    The offset at the end lets you know how divergent the system clock was with the newly set time. In this example, the system clock was off by a laughably small fraction of a second.

    Читайте также:  Сброс всех приложений windows 10

    You generally don’t need to do this if you use the “Set date and time automatically” feature within the Date & Time system preferences, though by setting clocks through the command line you could be sure that each machine on a network shows the exact same time.

    Set the Mac System Date Manually by Terminal Command

    Another approach is to set the date manually from the command line by using the “date” command string, where date is in the [mm][dd]HH]MM[yy] format, which is Month Date Hour Minute Year without any separation. This looks something like:

    For that example, it would set the date as “July 12 2018 at 12:23”.

    You can learn more about setting the date with date –help, which also specifies that you can even set the seconds if you want to.

    The ‘date’ trick is what you’d want to use if the Mac in question does not have internet access for one reason or another.

    Источник

    Установите системное время в Mac OS X из командной строки

    Часы в Mac OS X автоматически устанавливаются по умолчанию, но если вы хотите установить точное время или ищете решение командной строки для установки системного времени, вы можете сделать это с помощью инструмента ntpdate или стандартной «даты», команда.

    Установите Системную дату в Mac OS X из командной строки с помощью Центрального сервера времени

    Для ntpdate, который устанавливает дату и время на основе времени с центрального сервера, доступного через Интернет, вы должны указать его либо на серверах времени Apple, либо в pool.ntp.org следующим образом, чтобы получить точное время:

    sudo ntpdate -u time.apple.com

    Введите пароль администратора, когда его спросят, и вы скоро увидите что-то вроде следующего:

    4 июл 14:30:11 ntpdate [28267]: настроить сервер времени 17.151.16.14 offset 0.000336 sec

    Смещение в конце позволяет вам узнать, как расходятся системные часы с вновь установленным временем. В этом примере системные часы были выключены смехотворно малой долей секунды.

    Обычно вам не нужно это делать, если вы используете функцию «Установить дату и время автоматически» в настройках системы даты и времени, хотя, установив часы через командную строку, вы можете быть уверены, что каждая машина в сети показывает точный в то же время.

    Установка даты системы Mac вручную командой терминала

    Другой подход — установить дату вручную из командной строки, используя командную строку «date», где дата находится в формате [mm] [dd] HH] MM [yy], который является месяцем Date Hour Minute Year без какого-либо разделения , Это выглядит примерно так:

    В этом примере он установил бы дату «12 июля 2018 года в 12:23».

    Вы можете узнать больше об установке даты с датой -help, которая также указывает, что вы даже можете установить секунды, если хотите.

    Титк «даты» — это то, что вы хотели бы использовать, если у Mac, о котором идет речь, нет доступа к Интернету по той или иной причине.

    Источник

    Question: Q: Cannot set date on Terminal with mmddhhmmyyyy format. Please help ?

    I’m trying hard to set the date on Terminal, as I need to do this for something to work.

    Please help, I have no clue what to do. It’s April 8th 2014, 7:10pm and I’ve typed literally (without spaces):

    04 08 19 10 2014

    08 04 19 10 2014

    04 08 19 10 14

    04 08 07 10 2014

    please help, this is super super urgent, for work, trust me not lying !!

    MacBook Pro, Mac OS X (10.4)

    Posted on Apr 8, 2014 9:14 AM

    All replies

    Loading page content

    Page content loaded

    Читайте также:  Windows восстановление реестра ошибка

    What is the rest of the command you are using? Is this touch?

    Apr 8, 2014 9:16 AM

    hi, thanks so much for the reply !!

    My bad, fully I type this:

    There must be another syntax they’re looking for.

    I get this message:

    date: bind: Permission denied

    date: settimeofday (timeval): Operation not permitted

    Apr 8, 2014 9:21 AM

    OK did you look at the man page?

    Apr 8, 2014 9:26 AM

    just did. I get this:

    DATE(1) BSD General Commands Manual DATE(1)
    date — display or set date and time
    date [-ju] [-r seconds] [-v [+|-]val[ymwdHMS]] . [+output_fmt]
    date [-jnu] [[[mm]dd]HH]MM[[cc]yy][.ss]
    date [-jnu] -f input_fmt new_date [+output_fmt]
    date [-d dst] [-t minutes_west]
    When invoked without arguments, the date utility displays the current
    date and time. Otherwise, depending on the options specified, date will
    set the date and time or print it in a user-defined way.
    The date utility displays the date and time read from the kernel clock.
    When used to set the date and time, both the kernel clock and the hard-
    ware clock are updated.
    Only the superuser may set the date, and if the system securelevel (see
    securelevel(8)) is greater than 1, the time may not be changed by more
    than 1 second.

    Apr 8, 2014 9:24 AM

    Only the superuser may set the date, and if the system securelevel (see

    securelevel(8)) is greater than 1, the time may not be changed by more

    Apr 8, 2014 9:29 AM

    OK, but what can I do then to change the date on Terminal ? Apparently I need to do this to stabilize the date so I can install Mountain Lion (some bug with the time and date apparently..).

    Please tell me what to do .

    Apr 8, 2014 9:29 AM

    Apparently I need to do this to stabilize the date so I can install Mountain Lion (some bug with the time and date apparently..).

    Where did you get this idea? Please explain your situation.

    Apr 8, 2014 9:30 AM

    I’m trying to install Mountain Lion and a ton of ppl have had this same message appear when trying to install it (or Mavericks):

    The bug is actually a problem with stabilizing the date and time, and everything works for the installation just fine afterwards.

    There’s a thread here:

    So all that is keeping me from installing this bad boy is just the freaking date and time bug. PLEASE HELP ME, I’m DESPERATE . 😝

    srsly though. this is work-related important.

    Apr 8, 2014 9:33 AM

    dude, help please !! Tell me what to do ! Is there a way to freeze the time, or manually do something to the date withtout going through Terminal ? Or what other possible syntax, formula can I try on Terminal ??

    Apr 8, 2014 10:01 AM

    You must use superuser privileges to set the date but it is not necessary to enable root.

    sudo date mmddhhnnyyyy

    . but you must substitute the actual date and time in the command that corresponds to the date format used for your location. In other words if your custom is to use a date like 8 February 2014 then reverse the mm and dd values.

    Substitute numerals in the above command according to the following:

    hh = hour (24 hour format)

    nn = minutes past the hour

    Each of those values must be two digits except for the year which can be two or four digits. As an example if the current date and time is February 8, 2014 at 9 PM your command will be the following:

    sudo date 020821002014

    sudo date 0208210014

    Читайте также:  Windows 10 ltsc или professional что лучше

    Either one will work. If you enter nonsensical values the system will attempt to parse the entry correctly.

    Terminal will ask for your Admin Password — the same one you use when you log in to your Mac. Type it and then press the Return key. What you type will not appear, not even with •••• characters.

    To verify that your change was effective just type the date command and press the Return key. Terminal will reply with the date and time. The value entered does not have to be precise, it just has to be approximate. Selecting the «Set time and date automatically» checkbox and choosing an appropriate time server in System Preferences > Date & Time will adjust your Mac’s system clock to the precise time.

    Источник

    HOW TO: Change system date in OS X from Terminal

    If you’ve left your Mac lying around for a very long time or if you bought a used one, the system date may be out of whack. Often the system date on neglected Macs gets reset to the year 2001, which prevents you from reinstalling OS X, but you can get this done through Terminal.

    UPDATE: This article is dated and may not be relevant to your version of macOS. Please use with caution and understand that whatever you do to your Mac is on you. We hold no responsibility for any damage following this guide may cause.

    More often than not, you’ll get an error that reads, “An error occurred while preparing the installation. Try running again.” At this point, many people will throw in the towel and figure the computer is toast. But that’s usually not the case. A terminal window looks similar to this.

    Change System Date From Terminal

    Here are some simple steps to change the OS X system date from Terminal when doing a fresh install.

    • Insert a USB key with OS X install into Mac (or install disc)
    • Power up and hold the Option key down as soon as you hear the startup chime.
    • Choose OS X to install
    • Once booted into recovery, choose Utilities from the menu and then Terminal.
    • Type date into Terminal and hit enter; this displays the date; if it is not the current date, you need to go to the next step.
    • Type date into Terminal followed by today’s date in this format [month][day][hour][minute][year] so today is July 11, 2016, 2:15 that would be date 0711141516 then press enter. Of course, your date and time will vary.
    • Rerun the first command in Terminal date and press enter; the date should now be fixed.

    At this point, you should now be able to continue your reinstall of OS X on your Mac, and the installation error should no longer appear. For whatever reason, the system date matters when installing the OS on your Mac. So if you get that error, don’t panic and think your Mac is toast, try this fix first, and you should be golden.

    Conclusion

    This is a fairly easy fix, and it works wonders if you’ve purchased a Mac off of eBay or from Craigslist. Sometimes these Macs end up sitting around for a while, and the system date gets out of whack. Now you don’t have to worry about it being a brick and can bring it back to life.

    Did you use this method to fix your system date? Let us know in the comments below or on Twitter, or on Facebook. You can also comment on our MeWe page by joining the MeWe social network.

    Источник

  • Оцените статью