First, you need to disable Secure Boot prior to installation.
Disable Secure Boot
- Hold down Command-R as you power on or restart your Mac. Release the keys when the Apple logo and a progress bar appear. This will boot macOS Recovery.
- Wait until the Utility Menu appears.
- Select Reinstall macOS, then follow the onscreen instructions. This will preserve your apps, settings, and data - but you'll have a fresh copy of macOS.
If the above steps don't work, temporarily reduce or disable Secure Boot:
- Boot into macOS Recovery (see above).
- When the Utility Menu appears, don't select any options presented. Instead, go to the top menu bar and click on Utilities.
- Select Startup Security Utility from the drop-down menu.
- Enter your administrator password when prompted.
- Set the Secure Boot setting to None.
- Quit Startup Security Utility, then try reinstalling macOS again.
Internet/Network Recovery of El Capitan or Later on a Clean Disk
If possible, back up your files before proceeding.
You will need a fast, working Internet connection, preferably, Ethernet. If you must use Wi-Fi, you will be asked to select your network and enter the network password. This procedure will install the current version of macOS that is compatible with your model.
- Restart the computer. Immediately, at or before the chime, hold down the (Command-Option-R) keys until a globe appears.
- The Utility Menu will appear in from 5-20 minutes. Be patient.
- Select Disk Utility and click on the Continue button.
- When Disk Utility loads select the target drive (out-dented entry w/type and size) from the side list.
- Click on the Erase button in Disk Utility's toolbar. A panel will drop down.
- Set the partition scheme to GUID.
- Set the Format type to APFS (SSDs, only if installing Mojave or Catalina ) or Mac OS Extended, (Journaled.)
- Provide a volume name, usually "Macintosh HD."
- Click on the Apply button, then click on the Done button when it activates.
- Quit Disk Utility and return to the Utility Menu.
- Select Install OS X and click on the Continue button.