Modern Macs have a built-in diagnostic test that can be used to help troubleshoot a hardware problem. The technology has changed over the years, and the procedure is determined by how old your Mac is.
There a many ways a problem can crop up on your Mac. It could be a corrupted or failing boot hard disk or SSD, a flaky peripheral or a damaged or conflicted OS X. This article is restricted to the case where you suspect something is wrong with the very Mac itself.
The first step is to determine the OS version and year your Mac was introduced. One way to do this is to use Apple Menu > About This Mac. (If the introduction date for the product isn't specified, you can use a great app called Mactracker to convert a model number to an introduction date.)
The first applicable document here is Apple support doc #PH18765. In summary, as Apple states it:
- If your Mac is from 2013 or later, use Apple Diagnostics, which is built into your Mac.
- If your Mac is from 2012 or earlier and has OS X v10.8.4 or later, use Apple Hardware Test, which is built into your Mac.
- If your Mac is from 2012 or earlier and has OS X v10.8.4 or earlier, use the system software disc or USB flash drive that came with your Mac.
For this how-to, I'll discuss Macs introduced in June 2013 or later and the Apple Diagnostics.
The Apple Diagnostics has detailed steps on how to shut down your Mac, which peripherals to disconnect, and how to hold down the D key at boot. Note that there is no prefix key used here. Hold down just the D key right after you hear the startup chime.
Note that if you leave the Ethernet cable plugged in and boot with OPTION + D, you can do some extra things, such as access your support and service options and contact Apple support.
You should review this Apple Diagnistics page and even print it so you have a handy reference during the testing. Especially useful are the keyboard shortcuts that are available.
After booting, you'll see a black screen with a progress bar when the Apple Diagnostics start.
The test takes only a few minutes. When it's done, you see a notice with error Reference codes that describe the likely problem. Apple has an extensive page of error Reference codes that describe the problem(s) found, if any.
Test complete and Reference code provided.
If you get the code ADP000, "No issues found," you can reconnect your peripherals, reboot and look for the trouble elsewhere. Otherwise, follow the steps listed on the Reference codes page linked above.
Apple has provided a wealth of information that will help you isolate a possible problem with your Mac's hardware.