Apple Mac computers are reliable machines but in rare circumstances you may need to reinstall the operating system.

Fortunately OS X comes with an emergency repair system called OS X Recovery (available on all Macs running OS X 10.7 Lion or Later). In OS X Recovery mode you connect the Mac to the internet and download the OS X operating system. This enables a Mac to restore OS X without needing the installation disks (which is handy, as most Mac computers don't come with optical drives any more).

See also:

How to reinstall Mac OS X: What can I do with Mac OS X Recovery mode?

Use Disk Utility and other programs to fix a Mac in Recovery mode

You can do more than just install Mac OS X using Recovery mode. The Apple support website lists four possible uses for OS X Recovery:

  • Restore your Mac from a Time Machine backup.
  • Verify and repair connected drives using Disk Utility.
  • Check your internet connection or get help online using Safari.
  • Install or reinstall OS X.

In this feature we are going to look at how to use Internet Recovery mode to reinstall OS X on your Mac, but if you're troubleshooting a broken Mac it's worth using Disk Utility to see if you can fix the problem first.

Read next: What to do if your Mac doesn't finish installing an update

How to reinstall Mac OS X: How to access OS X Recovery mode

You access recovery mode by holding down the Command (Cmd, also known as the Apple key) and R keys during startup. Follow these steps to boot into OS X Recovery:

  1. Make sure you're located near a Wi-Fi point or are connected to a network with an internet connection. (It's best not to use public Wi-Fi for this; try to be at home or on a work network.)
  2. Turn off the Mac by going to Apple > Shut Down. If OS X is not responding, press and hold the power button until the Mac switches off.
  3. Wait for 30 seconds.
  4. Press the power button to switch the Mac back on.
  5. Hold both the Command and R keys on the keyboard until you hear the chime noise.

The Mac will now start in OS X Recovery mode.

How to reinstall Mac OS X: How to connect to the internet in OS X Recovery mode

To reinstall Mac OS X using Recovery mode you have to connect to the internet. Follow these steps to connect to the internet in OS X Recovery mode:

  1. Click the Wi-Fi menu in the upper-right corner of the screen.
  2. Select a Wi-Fi network.
  3. Enter the Wi-Fi password (if required).

OS X Recovery mode should now be connected to the internet and can download the OS X installation software.

How to reinstall Mac OS X: How to reinstall OS X using Recovery mode

You will now be able to download OS X and reinstall it on your Mac. Note that it is a large file and will take a while to download. The speed of this process is of course  dependent on your broadband connection: it's unadvisable to download OS X using a non-broadband connection. You will also need your Apple ID and password to install OS X from the App Store.

Click Install Mac OS X and Continue in the OS X Utilities section of the screen to begin the installation process. Follow the on-screen instructions to reinstall OS X.

Read next: How to create a Mac recovery partition in El Capitan and Yosemite