When Mac is not booting due to a corruption in the operating system and you use a Mac wireless keyboard you may find the Command + Alt + R does not work to get it into OSX internet recovery mode.
If you only have a Windows USB cabled keyboard to connect, restart the Mac from being powered off and just after it is starting up hold down Windows + Alt + R together until the mac shows Starting Internet Recovery
It will then ask you to Choose Network. Select your local wifi and enter the password.
It will then start downloading Mac OSX to run the recovery. As the image can be many Gb, depending on your internet speed this may take hours to progress.