All recent models of Mac contain built-in hardware diagnostics, known as either Apple Hardware Test or Apple Diagnostics. If you think your Mac has a hardware problem, they provide the best way of checking.
Older Macs may still need their original install (optical) disk(s), which contain their diagnostic software. You should insert the labelled disk into their optical drive, restart from that, and follow the instructions.
All more recent models can be started up in diagnostic mode, by holding down the D key. Apple’s instructions are here for Macs released before June 2013, which run Apple Hardware Test, and here for newer Macs, which run Apple Diagnostics.
Whichever you are going to run, prepare your Mac first by:
- disconnecting all peripherals except the keyboard, mouse, any external display, and Ethernet network cable;
- ensuring that your mouse and keyboard are connected by wired USB; rechargeable Apple wireless models should be connected to a USB port using their charging lead, which effectively makes them USB rather than Bluetooth wireless;
- if a laptop, connecting to mains power supply, and checking that the power is turned on;
- ensuring that there is adequate cooling air circulation, particularly for laptops, which should be operated on a firm, flat surface;
- having a pen(cil) and paper handy to record any error messages or codes.
Apple recommends that you should then shut your Mac down and start it back up, holding the D key before the display turns grey, until the diagnostics icon or text appears. You should also be able to enter diagnostics from a restart, but Apple recommends shutting down rather than restarting. If you need to disconnect peripherals, that is in any case wiser.
Initially, the diagnostics software checks your hardware configuration, to determine what tests it should run. You may then be invited to choose a language, and tests will either run automatically, or you may be offered a choice of standard or extended testing.
Once testing has been completed, the app will display a message containing the result, with a code. Make a note of that, as it will help Apple Support, the Genius Bar, or an authorised engineer to advise you on repair.
If the tests report that hardware appears to be functioning correctly, with a zero code, this does not prove absolutely that your Mac does not have a hardware fault. Some faults are intermittent, others only manifest when your Mac is warm or cold, and a few (some graphics card faults, in particular) simply don’t get picked up. But a clean bill of health is a good indicator that, whatever is causing your problems, it is unlikely to be a hardware fault in your Mac.
Provided that you have not reset the NVRAM, you can later retrieve the last diagnostics result from the NVRAM of recent Mac models using the Terminal command
which should give the result at the end in an XML field of the form
You can also display the results of the last test run in System Information: select the Diagnostics item in the Hardware section, as shown above.
If you cannot get the diagnostics to run properly, ensure that your Mac has an internet connection through its Ethernet port, and try again, holding the Option and D keys down. This will enter remote diagnostics, which is usually much slower.
If testing returns an error, you should be offered further information about support options, which normally proceed after your Mac automatically restarts into Recovery mode. Apple provides a detailed breakdown of the significance and meaning of error codes here.
As far as Apple is concerned, its tests are the standard, and augmented only by its own in-house advanced diagnostics. There are several third-party tools which can perform specific types of hardware testing and provide you with more information, without having to quit your work, let alone start up in a special mode. I list here those with which I am most familiar.
TechTool Pro is a mature and valuable product, which runs separate tests of:
- RAM, but in a more limited way than ATOMIC (below);
- Video RAM;
- disks – including surface scan, S.M.A.R.T. variables, volume structures, file structures;
- Bluetooth, WiFi, and Ethernet (TechTool Pro 9);
- internal sensors;
It also helps you check your video, iSight camera, audio, and carries out a range of disk utility functions.
ATOMIC is a dedicated RAM checker which can run stress tests and more, and is particularly useful if you may have an intermittent memory fault.
DriveDx is, in my opinion, the best of S.M.A.R.T. tools for those drives which support it. You can also install a free kernel extension which allows it to check USB, USB 3, and other drives which are not normally supported.
OpenGL Extensions Viewer (App Store) does some video testing which can be useful at times.
Updated 28 August 2016 to add hint on finding info in System Information.