Tests and reviews

Collect diagnostics on macOS using the command line. Mac Diagnostics, or How to Detect Hardware Issues on Your Apple Computers Using the System Software Disc or USB Flash Drive

Before going to a service center with their Mac, any user can independently check their computer for problems. Perhaps, knowing what the problem is, the user will be able to carry out simple repairs on their own.

Since the instructions from Apple are of little use in this case - they are sent exclusively to the service center, I have compiled my own guide to solving problems with the Mac.

  • If the computer was released after June 2013, then the checker is called “Apple Diagnostics”
  • If the computer was released before June 2013, then the test program is called the “Apple Hardware Functional Test”

Regardless of the name, the utilities work almost identically.

How to run Apple Diagnostics?

Step 1. Disconnect all devices except the mouse, keyboard, network cable and monitor.

Step 2: Turn off your computer.

Step 3. Turn on the computer and press the D button. Hold it until a special screen appears with a choice of language.

Step 4. Choose the Russian language and the check will start automatically. It does not last very long - 2-3 minutes.

If you do not start the usual diagnostics, then press Option + D at boot and the diagnostics will start using the Internet. For example, I had to do this, because I changed hard drives in my MacBook a long time ago and, of course, I no longer have a recovery partition. Such a picture can hang for 5 minutes. If it hangs, then restart your computer.

Here is what the diagnostic looks like Macbook Pro 2011. At the beginning we find and select the line “Select Russian as the main language”:

After that, click "Test":

Apple Error Codes on MacBook

Error codeProblemWhat to do?
ADP000No issues foundIf there is still a problem, then look for a solution on the Internet.
CNW001
CNW003
CNW004
CNW005
CNW006
There may be a problem with the Wi-Fi module.
CNW007
CNW008
No Wi-Fi networks found. There are no Wi-Fi networks available, or the Wi-Fi module is defective.Try wifi network at that location on another device. If it works, then you have a problem with the Wi-Fi module.
NDC001
NDC003
NDC004
NDC005
NDC006
There may be a problem with the camera.
NDD001There may be a problem with the USB module.Disable everything USB devices and run the test again. Then connect the working device in turn to the Wi-Fi modules and start the scan.
NDK001
NDK003
NDK004
There may be a problem with the keyboard.
NDL001There may be a problem with the Bluetooth module.Try connecting multiple different devices in the system and clarify whether there are indeed any problems with Bluetooth.
NDR001
NDR003
NDR004
There may be a problem with the trackpad.
NDT001
NDT002
NDT003
NDT004
NDT005
NDT006
There may be a problem with the Thunderbolt module.Disable Thunderbolt devices. Run the test again.
NNN001Serial number not found.
PFM001
PFM002
PFM003
PFM004
PFM005
PFM006
PFM007
There may be a problem with the System Management Controller (SMC).
PFR001There may be a problem with the computer's firmware.
PPF001
PPF003
PPF004
There may be a problem with the fan.You can theoretically disassemble the laptop, remove the fan and clean it. I do this every six months.
PPM001There may be a problem with the memory module.You can disassemble the laptop. Get the memory modules, if possible, swap the strips.
PPM002
PPM003
PPM004
PPM005
PPM006
PPM007
PPM008
PPM009
PPM010
PPM011
PPM012
PPM013
PPM014
PPM015
There may be a problem with the built-in memory.
PPP001
PPP002
PPP003
There may be a problem with the power adapter.Disconnect the power adapter from the mains and from the computer. Connect again and test.
PPP007The power adapter has not been tested.Reconnect the power adapter to a known working outlet. Run the test again.
PPR001There may be a problem with the processor.Sadness, if the error repeats ... Here it’s definitely better to take it to the service.
PPT001Battery not found.
PPT002
PPT003
The battery will need to be replaced soon. It is serviceable, but its capacity has decreased.On some Mac models, the battery can be completely replaced by yourself.
PPT004It is required to re-diagnose via the Internet (described at the beginning of the article). Through Internet Apple Uses the latest battery diagnostic tools. If the problem is confirmed and the performance of the battery does not suit you, then consider replacing it.
PPT005The battery is installed incorrectly. Shut down and turn off your computer. The computer needs service.Disconnect and reconnect the battery.
PPT006The battery needs service. The battery is defective, although this may not affect performance or capacity. You can continue to use the battery without harm to your computer until the test is completed.I would still replace the battery if the capacity drops to zero, because without it, Mac OS automatically slows down the performance of the computer. It comes down to noticeable brakes.
PPT007The battery needs to be replaced. The battery is good, but its capacity has decreased significantly. Until you replace the battery, you can continue to use it without harming your computer.Above is the advice!
VDC001
VDC003
VDC004
VDC005
VDC006
VDC007
There may be a problem with the SD card reader.
VDH002
VDH004
There may be a problem with the storage device.Check hard drives for errors with special utilities.
VDH005Unable to start OS X recovery.OS X can even be installed from a flash drive. Look for instructions - it's easy.
VFD001
VFD002
VFD003
VFD004
VFD005
VFD007
There may be a problem with the display.
VFD006There may be a problem with the GPU.
VFF001There may be a problem with the audio hardware component.

What else do you need to know?

Not always the test displays errors. Here I have some problems with the SD slot, but the test did not reveal any errors. May need extended testing.

Many problems, especially with older models, can be solved on your own, but if you are not confident in your abilities, then bring it to an Apple service center. The older the model, the easier it is to disassemble, which means it is easier to fix the desired module.

One of the most simple ways To find out if your Mac is having hardware problems, run the Apple Hardware Functional Test or Apple Diagnostics. Yes, most users of Apple technology do not experience any malfunctions, but problems sometimes arise: damage to the drive, memory failure, unstable graphics or motherboard. There are many different kinds of hardware defects.

The good news is that the Apple Hardware Functional Test allows you to effortlessly determine if a hardware failure exists. Please note that the Apple Hardware Functional Test can only be run on devices manufactured prior to June 2013. On newer models, Apple Diagnostics is loaded.

The programs are somewhat different, but they have the same functionality. Hardware testing is the same on all Apple computers, be it iMac, MacBook, MacBook Pro, Macbook Air, Mac mini or Mac Pro, the version of the operating system also does not matter.

How to run Mac hardware diagnostics:

Step 1: Connect your Mac to a power source.

Step 2: Disable all external devices except for the display, keyboard and mouse.

Step 3: Turn off your Mac and press the power button again to turn on your computer.

Step 4: Press and hold the "D" key on your keyboard until a gray boot screen* appears.

Keep holding "D" until a progress bar appears instead of the normal loading screen.

  • If your Mac boots into Apple Hardware Functional Test mode, an icon will appear on the screen.
  • If your Mac is loading Apple Diagnostics, you will see a progress bar or language selection screen.

Step 5: For "Hardware Functional Test", check "Perform advanced testing" and click "Test". In the case of Apple Diagnostics, wait for the Mac to finish checking.

The diagnostic tool will notify you of any problems it finds.

  • If any error is found, then your Mac has a hardware problem.
  • If no errors are found, the computer hardware is OK and there is most likely a problem with the software. In this case, you should do backup data and reinstall Mac OS X.

*If you're having trouble downloading Apple Diagnostics, press Option + D to download the test online.

If a malfunction is found during the test, write down the error code and other details shown on the monitor. This will help you when contacting technical support. For Mac computers Apple Diagnostics at support.apple.com has help error codes.

The example below shows that the "Apple Hardware Functional Test" found a problem with the SATA interface and returned an error code: "4HDD /11/40000000: SATA(0,0)". This means a malfunction hard drive.

If you're having problems with your Mac and it's still under warranty, you should contact an Apple Authorized Representative. Some errors can be fixed by yourself by replacing the RAM or hard drive, but if the case is under warranty, you should not worry, as an Apple certified service center is obliged to repair the computer free of charge.

If the warranty has expired, you can try to fix the problem yourself, but this method is only suitable for tech-savvy users.

It is very easy to distinguish a hardware failure from a software one. A damaged hardware problem cannot be fixed by reinstalling the operating system, while a software problem will most likely go away. It is also worth bearing in mind that some software itself does not work correctly and such problems appear only when using a specific application.

Today we will talk about collecting diagnostics in macOS

Information about the computer and programs

If you select "About This Mac" from the Apple menu and then click the "System Report" button, you'll see a bunch of information about your computer. So, the system_profiler utility is the same, but a hundred times more detailed.

If you call system_profiler without parameters, then the information will be displayed in full, which in my case means 3.8 MB of text. So I recommend immediately writing something like system_profiler > ~/Desktop/profile.txt or using grep to find the line you need.

MAC Diagnostics

Among what system_profiler will spit out, you will find information not only about the system and devices, but also about all programs, drivers, plugins, libraries and fonts. At the same time, parts of the system logs and a bunch of other crap will be displayed.

If all this does not interest you, write system_profiler -detailLevel mini, and then you will get only information about the computer.

You can also add the -xml parameter to make it more convenient to process the received information in the script.

Directory Service

The dscl - Directory Services Command Line utility is responsible for communicating with the directory service; it once replaced netinfo. Smells like sysadmin tricks? This is true, and we will not dwell on them in detail.

For starters, a couple of commands: dscl . -list /Users will list all users and dscl . -read /Users/<имя пользователя>- information about the user in the form of XML. Even a file with an avatar is encoded inside!

By the way, if you run dscl without parameters, it will enter interactive mode, where you can use the usual cd and ls commands to navigate, and view the contents of the branches with the read command.

Directory Services Caches and User List

Another utility is attached to dscl - dscacheutil, it is responsible for working with directory service caches. You probably know it much better than dscl, because for a long time it was the one you had to run to flush the DNS cache.

By the way, in latest versions macOS does not work, and instead of dscacheutil -flushcache you now need to write killall -HUP mDNSResponder.

MAC Diagnostics

As for dscacheutil, it's handy to use to list users: dscacheutil -q user. Unlike what dscl produces, the result is much easier to read.

Reading and (not) resetting values ​​in NVRAM

Every Mac has a non-volatile memory that stores variables that are important to the operation of the computer. What exactly is there? The nvram command will help you find out: write nvram -xp, and you will see everything.

There are innocuous things like the sound level and the latest keyboard layout, as well as more interesting things like the Find My Mac key and the completely mysterious EFI settings.

All of them are presented in binary form, and the only snippet of description that I could find is contained in a leaked CIA document posted on WikiLeaks.

Parameters can be set with the nvram command<переменная>=<значение>, delete with nvram -d command<переменная>or load from file with nvram -f<файл>.

You can reset everything by typing nvram -c. But usually NVRAM parameters are reset only if something went wrong and the computer does not boot. To do this, press Alt-Cmd-P-R immediately after switching on and hold for 20 s.

Please note: if you change the parameters with the nvram utility, then they will not be written to non-volatile memory immediately, but only when the computer is turned off in normal mode.

RAM statistics

There are many ways to see how loaded the RAM is. Perhaps the easiest is to open the "Memory" section in "System Monitoring": the most useful parameters are presented there in a visual form. From command line it's best to use top.

If you need the most detailed information, then you can refer to vm_stat. The disadvantage of this utility is that all values ​​are given in pages equal to 4 KB. However, it's not that difficult to calculate, and there are a lot of scripts on the Internet - for example, this Perl one-liner converts everything into megabytes.

You can also use vm_stat to track changes in memory usage over time. To do this, type vm_stat -c<число> <секунды>, where the first parameter is the number of measurements, and the second is the interval between them.

Flush disk cache in memory

The purge command helps to temporarily get a couple of extra gigabytes of RAM. It is called from root, has no parameters and resets the disk cache, bringing it to the state it was in after the OS was loaded. But usually the memory manager does not need such help - he himself will gradually unload the excess if the RAM runs out.

The help says that purge is generally needed mainly for testing, but who knows how life will turn out?

File system access tracking

The fs_usage command, run without options as root, prints a record of each access to file system. This is needed in cases where some program crashes on startup or produces cryptic error messages. If the problem is that one of the files is corrupt, then you can find it with fs_usage.

To reduce the need to rummage through the output, limit the messages to one process by writing its name after fs_usage. If you only know the ID, type sudo fs_usage pid .

Another useful parameter is -f, after which you can set a filter for network operations (-f network), files (-f pathname will add a path column) and so on. If the text doesn't fit on the line, add -w.

If your Mac is experiencing any unusual technical issues, you can use Apple Diagnostics to find out their causes and even fix them.

Apple Diagnostics will run several tests in order to detect problems not related to the system, but to the device itself. It could be a broken port, a bad battery, a display problem, etc.

This program is essentially a reincarnation Apple programs hardware test. Apple Diagnostics is for newer Macs, and 2013 and older models use Apple Hardware Test. The old program displays more information, and Diagnostics is more concise. However, both programs work in the same way and are great for identifying and resolving issues with Mac parts.

Opening Apple Diagnostics on a Mac is very simple - you just need to press a keyboard shortcut at startup. Further on this in more detail.

How to open DiagnosticsApple on theMac


There may be many different messages about different problems. If you do not know what to do, you can contact the service Apple support or contact a specialist.

Please note that Apple Diagnostics may not detect all problems, and in this case, the only thing left is to immediately seek help from a specialist. Such problems include cases when the computer periodically does not start or, on the contrary, turns off by itself. Also, the program will not detect physical damage to the device, including damage from contact with liquids.

Apple Diagnostics isn't perfect, but it's a great place to start troubleshooting any technical issues with your Mac, iMac, MacBook, MacBook Pro, and more.

launch DiagnosticsApplethrough Internet

Apple Diagnostics can also be launched over the Internet by holding down the Option + D keys during startup. The process will take longer, and there are no more differences with the previous method.

What to do with diagnostic codesApple?

If the program finds a problem, it will give you a code and a short description. More information can be obtained by checking the code on the Apple Reference Codes site. There you will learn more about your problem.

How else to solve technical problems

Apple Diagnostics is very useful, but it won't fix every problem. You can try the following:

  • Run the Apple Diagnostics tests and repeat them as many times as you like.
  • Reset the system management controller.
  • Contact Apple Support or see a specialist.

Technical problems do not occur very often, and most of them can be solved. Many of these problems are even covered by the warranty, which can be repaired free of charge.

Do not miss Apple news - subscribe to our Telegram channel, as well as to YouTube channel.

The easiest way to avoid the help of service centers when looking for hardware problems (not all of them have a good reputation) is to use the built-in Mac diagnostics. In this article, we will tell you how to run and use the "Apple Hardware Functional Test" and "Apple Diagnostics".

With the help of standard diagnostic tools, you can effectively detect hardware malfunctions (problems with a hard drive, solid state drive, RAM, graphics processor, motherboard and other nooks and crannies of iron). How to do it?

On which Macs which utility

Regardless of the Mac model (MacBook, iMac, Mac mini or Mac Pro) and year of manufacture, operating system includes a hardware self-diagnosis utility. In computers that were released before June 2013, it is called the "Apple Hardware Test" (Apple Hardware Test - AHT), and after - "Apple Diagnostics".

Before running any of the utilities, be sure to turn off all peripheral devices (including optical drives, if such antiquity is still available) except for the keyboard, mouse, display, and Ethernet adapter. Some versions of OS X Lion and later may require Ethernet or Wi-Fi to run the internet version of AHT. It is no different from the offline counterpart.

To use AHT, be sure to connect your MacBook to a power source.

List of keyboard shortcuts

If there is no mouse, then the following shortcuts will come in handy:

  • Option (⌥) + D: run internet diagnostics;
  • Command (⌘) + G: start operation;
  • Command (⌘) + L: display a list of languages;
  • Command (⌘) + R: run the test again;

How do I use the Apple Hardware Functional Test or Apple Diagnostics?

Note: The Apple Hardware Functional Test and Apple Diagnostics work in the same way. The only caveat is that Apple Diagnostics requires an active Internet connection to run, and the interface will be much prettier.

1. Turn on or restart your Mac if it is turned on.

2. While powering on, press and hold the "D" key until the gray boot screen appears, then wait a few minutes for the AHT configuration to complete. During the download, the following icon will be displayed:

3. Now select the language and press the button to the right (if a mouse is not connected to the computer, then select the language using the arrows, and enter using the "Enter" key).

4. After the ANT console loads up, select one of the tests you want to run.

Main test- press the "Test" button, or the T or "Enter" key.

Full test- under the "Test" button, the "Perform advanced test" checkbox.

After the test is completed, the results will be displayed in a window located in the lower right corner of the console.

To exit ANT, click the Restart or Shut Down button at the bottom of the window.

What do the results say?

If during the test problems with the hardware are found, then get ready to contemplate the error and some explanatory details.

You can decipher AHT errors on the Apple technical forum, and in general I recommend that you go there first of all when looking for solutions to problems with apple gadgets. True, you will need knowledge of English at least with a dictionary.

Codes Apple errors Diagnostics and their decoding can be viewed.

In any case, if it was not possible to avoid repair in the service center, we strongly recommend that you contact only certified specialists who specialize exclusively in Apple technology. It will cost a lot, but buying a new gadget is much more expensive. It’s better to forget about the basement workshops “at Uncle Vasya’s”. Repairing apple devices requires a very meticulous approach and advanced skills.

According to yablyk