macOS

Change Date in macOS via Terminal

Rafal Kukla
Rafal KuklaFounder & Technical Director
3 min read
Change Date in macOS via Terminal

Fix macOS installation errors by correcting the system date in Recovery Mode. A quick Terminal command can resolve 'An error occurred while preparing the installation' issues.

If you've ever encountered a frustrating error message while updating or reinstalling macOS, you're not alone. Thousands of people have faced this issue, and this guide will help you resolve it.

Installation Error

An error occurred while preparing the installation. Try running again.

This error typically appears during macOS installation or upgrade to Catalina, Mojave, High Sierra, or any other version. The most common cause? An incorrect system date.

Why Does This Happen?

The macOS installer checks certificates and expects the system clock to match current standards. If your Mac has been sitting unused, the internal battery may have drained, causing the date to reset. When the date is out of sync, the installation certificates appear invalid and the process fails.

How to Fix: Change Date via Terminal

Step 1: Boot into Recovery Mode

Restart your Mac and immediately hold down Command + R until you see the Apple logo or a spinning globe.

Step 2: Open Terminal

Once in Recovery Mode:

  1. Cancel the installation process if it's running
  2. Navigate to Utilities in the menu bar
  3. Select Terminal

Step 3: Check the Current Date

In Terminal, type the following command and press Return:

Terminal
$ date

You should see output showing the current system date. If it's incorrect (showing a date from years ago), that's your problem.

Step 4: Set the Correct Date

Use this command format to set the correct date:

Terminal
$ date {month}{day}{hour}{minute}{year}

Each value should be a two-digit number. For example, to set November 16th, 2018 at 21:16:

Terminal
$ date 1116211618

Press Return to apply the change.

Step 5: Verify and Continue

Run the date command again to confirm the change was applied. Once correct:

  1. Type exit or close Terminal
  2. Return to the macOS installer
  3. The installation should now proceed normally

Summary

An incorrect system date is one of the most common causes of macOS installation failures. The fix is simple:

  1. Boot into Recovery Mode (Command + R)
  2. Open Terminal from Utilities
  3. Check date with date command
  4. Set correct date with date MMDDhhmmYY format
  5. Retry the installation

If the problem persists after fixing the date, consider:

  • Checking your internet connection
  • Verifying your installation media
  • Consulting Apple Support
Need Help?

If you're still having trouble, feel free to contact us at FilioTech. We're happy to help with macOS troubleshooting and support.

Topics

macOSTerminalTroubleshootingRecovery Mode

About the Author

Rafal Kukla

Rafal Kukla

Founder & Technical Director

Rafal is the founder of FilioTech with over a decade of experience helping businesses with their technology needs. From Apple Mac support to cloud architecture, he brings practical solutions to complex technical challenges.

Stay Updated

Get notified about new articles, tutorials, and updates from FilioTech. No spam, unsubscribe anytime.

Related Articles