If your Mac does not boot, there is a hidden "recovery mode" that lets you diagnose and fix problems or completely reinstall macOS.
First, you need to boot into recovery mode. Luckily that's easy. Turn off your Mac and restart it. While holding down the Command + R key. This should put you in recovery mode where you will see the macOS Utilities window. The recovery mode offers four services. You can recover from a Time Machine backup, obtain online help from the Apple Support Web site, troubleshoot Disk Utility problems, and reinstall macOS. We will focus on the last two options in this article.
RELATED: How to fully restore macOS from a Time Machine backup in recovery mode
Perform first aid from your recovery partition
The recovery partition on all Macs comes with a Disk Utility that can run First Aid on a potentially damaged drive and tries to fix some problems. This
Warning: If the Disk Utility tells you that your drive is down, take it seriously. We recommend backing up your Mac (if you do not already) and replacing the hard drive. The Disk Utility can not repair a failed disk.
When you're done, restart the macOS. If the Disk Utility did not solve all the problems, you can run it again. If the Disk Utility reports that it can not resolve some errors, it is probably a good time to back up and replace the disk.
If all other errors: reinstall macOS
Sometimes you just have to start over. Fortunately, you will not lose your files when you reinstall macOS, because it uses the same process as when you upgrade. Of course, this assumes that your hard drive is still working and not completely damaged. This can lead to problems. However, it is best to first make a backup that you can run with the Disk Utility without loading it into macOS.
In the recovery mode splash screen, select "Reinstall MacOS" to enter the installer.
You must agree to the terms of service and select the drive on which you want to install. Go ahead and select your main drive.
The installation process is in progress, and when you're done with it, you should start a new copy of macOS with the hopefully intact files.