Hardware diagnostics

If you suspect that your Mac may have a hardware problem, or need to rule one out, the first step to take is to run Apple Diagnostics or, on Mac models released before June 2013, Apple Hardware Test (AHT). Although they may not be as thorough in some respects as third-party alternatives, they’re the benchmark sets of hardware diagnostics. Very old Macs may still require you to restart from one of their original install disks which contains their equivalent.

Run Diagnostics

To run Diagnostics or AHT properly and generate the most reliable result, prepare your Mac first:

  • if you have a firmware password enabled, turn it off before trying to start up in diagnostic mode, or that won’t work;
  • disconnect all peripherals except the keyboard, mouse, any external display, and any Ethernet network cable;
  • ensure 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;
  • if a laptop, connect to the mains power supply, and check that the power is turned on;
  • ensure that there is adequate cooling air circulation, particularly for laptops, which should be operated on a firm, flat surface;
  • have a pen(cil) and paper handy to record any error messages or codes.

Once you’ve done all those, shut your Mac down, leave it ten seconds or so, then start it up holding the D key down until you see a list of different languages. Then release that key and select the appropriate language. Shortly after that, a progress bar will appear and the diagnostics will run to completion.

DiagnosticsRunning

At the end of those, you’ll be given the result code, which should be ADP000 if all tests were passed OK. Make a note of that, prepare your Mac for restarting, then click on the Restart button at the bottom of the window. Apple’s account of this procedure is here for Macs released before June 2013, and here for newer Macs.

DiagnosticsResult

Once your Mac has restarted, you can display the results of the last test run in System Information: open About This Mac, click on the System Report… button, and select the Diagnostics item in the Hardware section.

ahtlastrun

Provided that you haven’t reset the NVRAM, the same information can be retrieved from your Mac’s NVRAM using the Terminal command
nvram -p
which should give the result at the end in an XML field of the form
aht-results _namespdiags_aht_valuespdiags_last_run_key2016-08-07T12:27:04Zspdiags_version_key1.0.18spdiags_reference_code_keyADP000
If the results from that are unintelligible, try
nvram -xp
instead.

If the tests report that hardware appears to be functioning correctly, with a zero code or ADP000, this does not prove absolutely that your Mac doesn’t 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.

Remote Diagnostics

If you cannot get the diagnostics to run properly, ensure that your Mac has an internet connection through its Ethernet port or Wi-Fi, and try again, holding the Option and D keys down. This will enter remote diagnostics, which are usually much slower. Inability to enter normal diagnostics suggests that your boot disk may not have been correctly formatted into the different volumes required, or the diagnostics routines haven’t been installed correctly on your Mac: see below.

Error codes

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. Here is a succinct summary:

  • ADP000 – no issues found, although more advanced diagnostics could still detect a hardware problem.
  • CNWxxx – WiFi hardware issues. If the codes are CNW007 or CNW008, ensure your Mac is in range of an active WiFi network, then repeat the test.
  • NDCxxx – built-in camera issues.
  • NDDxxx – USB hardware issue. Disconnect all external devices except those listed above and repeat the test.
  • NDKxxx – keyboard issue. Most likely on a laptop; if not, repeat the test with a different keyboard.
  • NDLxxx – Bluetooth issue.
  • NDRxxx – trackpad issue. Most likely on a laptop; if not, repeat the test with another trackpad if you can.
  • NDTxxx – Thunderbolt issue. Disconnect all Thunderbolt devices and repeat the test.
  • NNNxxx – no serial number found. This usually indicates a motherboard problem.
  • PFMxxx – SMC issue.
  • PFRxxx – firmware issue. This is unlikely to be fixed by the user attempting to update the firmware, though.
  • PPFxxx – fan issue.
  • PPM001 – memory module issue. You can try removing or replacing memory modules, if supported by your Mac.
  • PPM002-015 – onboard memory issue. Not user-replaceable.
  • PPP001-003 – power adaptor issue. Disconnect the power adaptor, reconnect, and run the test again, or try using a different adaptor.
  • PPP007 – ensure power adaptor is connected and power turned on, then repeat the test.
  • PPRxxx – processor (CPU) issue.
  • PPT001 – battery not detected. Check battery and repeat test.
  • PPT002-003 – battery holds limited charge and will need replacement soon.
  • PPT004 – battery issue. Shut down and run Diagnostics over the internet to confirm.
  • PPT005 – serious battery issue. Shut down and don’t use.
  • PPT006-007 – battery issue. Battery will not function normally, but you can continue using your Mac until the battery is replaced.
  • VDCxxx – SD card reader issue.
  • VDH002, 004 – storage device (HD/SSD/Fusion Drive) issue.
  • VDH005 – unable to start macOS Recovery.
  • VFD001-005, 007 – display issue.
  • VFD006 – graphics adaptor issue.
  • VFFxxx – audio hardware issue.

That list hasn’t been updated for over two years, and may be incomplete.

The current version (1.0.38 dated 18 June 2019) of Diagnostics contains tests for the following systems: Audio Controller, Audio Port, Backlight Controller, Battery (if present), Bluetooth, Boot ROM, Camera, Chipset, Current Sensor, DIMM, Display, Display Port, Ethernet Controller, Fan(s), Keyboard, Memory, PCIe, Power Port, Processor, SATA, SD Card Reader, SMC, Speaker, Temperature Sensor, Thunderbolt ports, Trackpad (built-in), USB bus, Video Controller, Voltage Sensor, and Wi-Fi.

Updates and problems

Apple Diagnostics is updated as part of macOS updates, and installed onto a volume which isn’t protected by FileVault in the boot partition on your startup disk. This means that you don’t have to enter your FileVault password when running it on a T2 Mac, or one with its startup volume encrypted using FileVault.

Macs that were made between about 2007 and May 2013 normally run AHT from code which is hidden away in /System/Library/CoreServices/.diagnostics, which often seems to get wiped and not restored when you replace the internal storage, or perform a clean re-install. Those can easily leave your Mac relying on remote AHT unless the contents of that folder are replaced.

Unfortunately, because of SIP, restoring a local copy of AHT isn’t easy. You need a copy of the correct version of AHT not just for your Mac model, but for its specific series of logic board. Most users don’t go through the process of trying to put it back in place, but instead install it on a bootable USB memory ‘stick’ instead, where they know that it won’t be at risk of being wiped again.

However, if your Mac can’t run Diagnostics locally, you’d also be wise to check that it has a functional Recovery partition, in case that wasn’t configured properly as well. Not only can you test this by trying to start up in Recovery mode, but you should be able to identify it using the
diskutil list
command, where your startup disk should have a volume named Recovery, whether it’s in HFS+ or APFS format. As this isn’t mounted during normal running, you won’t see it in the Finder or Disk Utility.

Replacing a Recovery partition isn’t a simple task either. One example of doing so is given here, and the AppleScript tool to simplify that is available from here.

There are several third party diagnostic tools which are available, most famous of which are TechTool Pro, for general hardware coverage, its specialist memory testing sibling ATOMIC, and several drive diagnostic kits including my favourite DriveDx.

Intermittent problems

Memory faults are commonly intermittent, and can persist even though diagnostics claims that they’re fine. If you suspect an intermittent memory fault, then more exhaustive testing using ATOMIC may confirm it. Alternatively, get an Apple Genius Bar to run their fuller in-house diagnostic tests.

Other intermittent faults can also be infuriatingly elusive. These include incipient graphics card failure due to lead-free solder, which has been a common problem in many older Macs, such as iMac 5K models. Such problems are usually more frequent when first starting your Mac up from cold, although some work the opposite and are more likely when the Mac gets warm.

In those cases, run diagnostics when the problem is more likely to be obvious, either at the first start-up of the day, or when the Mac has thoroughly warmed through. When taking your Mac for further diagnosis and repair, be sure to tell the engineer when the problem is most likely to occur – it’s a valuable clue to them as to what it might be, and how best to test for it.

Extended service

Finally, always check whether your Mac model is eligible for extended warranty service because of an acknowledged fault. You never know, even though it’s AppleCare has expired, you may still get it fixed free of charge.