I have replaced original hard drive to samsung SSD and upgraded memory too.
I have now installed El Capitan and want to run Apple Hardware Test.
I have already tried 'D' , Option + 'D' both didn't do anything.
I have checked under "/System/Library/CoreServices" and no ".diagnostics" folder. I tried to copy this folder to CoreServices and not able to do that since error message says no permission.

sudo cp -R /Volumes/AppleHardwareTest/System/Library/CoreServices/.diagnostics /System/Library/CoreServices

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

cp: /System/Library/CoreServices/.diagnostics: Operation not permitted
cp: /Volumes/AppleHardwareTest/System/Library/CoreServices/.diagnostics: unable to copy extended attributes to /System/Library/CoreServices/.diagnostics: Operation not permitted
cp: /System/Library/CoreServices/.diagnostics/diags.efi: No such file or directory
cp: /System/Library/CoreServices/.diagnostics/Mac-F42386C8: No such file or directory
  • I've genericised your title to perhaps make it easier for future Googlers to find.
    – Tetsujin
    Oct 9, 2015 at 7:31

5 Answers 5


I followed 'Drew Reece' instructions below which was given in apple discussion forum. https://discussions.apple.com/message/27529118#27529118 and it worked fine for me without messing my machine. even AHT test passed in loop mode, still sometimes I get freeze while using safari and only option to recover is to restart the machine. Not sure whether AHT test is through and I have no hardware issue or its El Capitan issue on my mid 2007 24" iMac.

Grab the AHT disk image from Apple.com, github has a list be sure you have the correct model. https://github.com/upekkha/AppleHardwareTest In Terminal view the output of these two lines… sysctl hw.model | awk '{ print $2 }' ioreg -l | grep board-id | awk -F\" '{ print $4 }' … and compare to the github list

Inside an admin account (it needs to use sudo for 'blessing' the system). Grab my script, open the ZIP file. In the folder that is created (probably called 2e5eed7dbfbd5dd7e929-6ddeffa80174801842f729c8657e3c460e0ed540 !) drag that script onto Terminal. Then drag the AHT disk image onto Terminal & finally drag the destination disk (a USB disk formatted to Macintosh OS Extended).

It should look a bit like…

[~/]$ /Users/USERNAME/Downloads/2e5eed7dbfbd5dd7e929-6ddeffa80174801842f729c8657e3c460e0ed540/AHT-my- disk.sh /Users/USERNAME/Downloads/AHTdiskimage.dmg /Volumes/path-to-USB

NB: The bold parts will be specific to your system, there are spaces between the file paths. If you are unsure paste the command here & we can try to confirm it is correct, Terminal correctly escapes spaces & other special characters in file paths if you use drag & drop, so it should complete them correctly for you.

Hit return & it should ask for confirmation and then copy over the AHT disk & offer to bless the tool for use on next boot.

I haven't tested this on 10.11 & I cannot do so at present, sorry. If it fails it is possible to copy over by hand, but that takes a lot of describing. The script just uses the cp command to copy the relevant files over after mounting the disk image. The USB destination is not erased, but avoid copying it to a disk that has valuable data (just in case, have a backup).

It may also appear as a bootable disk in the 'boot picker' (hold alt at startup), this seems to vary on some models.


you could do above commands booting with command + R ,enter terminal and use the csrutil disable afterwards you can proceed into copying the AHT to the Systems folder. And then boot with d button pressed.


IF anyone is still struglling with this, you need to use full instalation disks - not upgrade disks. ANy will do as you are working from the disk not the OS on the machine. SO,if you have the grey Tiger disks, put in disk one. Boot with the D key held down before the chimes and hold it until the blue utility screen opens. IF you have replaced the HD with an SSD you will have likely cloned yoir old disk and the unaccesible repair and utility section will not have been cloned with it so other options are not availble. BEst Ian

  • 1
    P.S it' s definitely disk one in case you think that's a mistake. I'm running a hardware test on a 2007 imac running el capitain using a Tiger disk one as I type
    – Ian
    Oct 14, 2016 at 10:40

Just as addendum it is NOT ALWAYS on the first disk. On my Mac Pro 2009 the Apple Hardware Test is on the "Applications Install" disk along with a ReadMe on how it works. I found this out after a frustrating number of attempts with disk one.


I'm guessing a 2007 iMac came preinstalled with maybe Mac OS 10.4, so won't have the built-in AHT - nor will it be able to use the Internet version of AHT.

Since Lion, AHT would be on the boot/recovery partition, but as you've swapped out the original drive, that may no longer exist.

Other than putting back the old drive & running it from there, your only option may be to use the DVDs that came with the machine. AHT is on the second disk.

Your last option would be to try the version of AHT for your machine from this list at https://github.com/upekkha/AppleHardwareTest who have this to say about 'losing' the original AHT...

If however, you reinstalled an older computer from scratch, the diagnostic tools might no longer be available. Unless you have the original disks that came with your computer, there seems to be no way to restore the AHT.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .