Warning – Make a backup of your important data before you proceed.
Press Power button – Upon hearing the Apple Startup Sound – Press Command + Option + R Kegs till you see a spinning globe.
Connect your iMac to your WiFi
Once you’re iMac is connected to Apple Servers, launch disk utility to wipe your drive. After that you can choose OS, it should install the original OS. Once done, restore your files from the backup and enjoy!!
