Start your Mac from the macOS Recovery partition. Turn on your Mac and hold 'Command + R,' 'Option + Command + R,' or 'Shift + Option + Command + R' for a few seconds.
When the Apple logo, a spinning globe, or a pop-up requesting a firmware password displays, release the keys.
Click 'Continue' after selecting 'Reinstall macOS' from the Utilities Window.
Select the hard drive you wish to install the OS on and begin the installation by following the onscreen instructions.
During the installation, do not put your Mac in sleep mode or close its lid. While reinstalling the Mac OS, it's typical to see your Mac restart numerous times or have the screen go blank. Simply wait for the process to complete.