Finally, quit Disk Utility and select "Reinstall macOS" or "Install macOS" (or Mac OS X, for older versions) from the macOS Utilities window. Follow the rest of the prompts to finish the installation.