How to run apple hardware test on mavericks?
Since it does not show up with D at start up lets look for it on your hard drive.

The AHT is stuffed into an AHTxx.dmg file and found on the Recovery HD volume that is also hidden.

First you have to make the hidden partitions visible

To enable the see all partitions in Disk Utility (the Debug Menu)

defaults write com.apple.DiskUtility DUDebugMenuEnabled 1


In Disk utility now there will be a tab called Debug.

Use it to show hidden partition.

You will now see the Hidden partition called Recovery and EFI.

Mount the Recovery to see the files in finder and find the AHTxx.dmg

If it is not there, try using internet recovery with cmd-r.

see this for more options.

Also, you might be able to download a copy of AHT using this link and providing the correct 4 digit model number. (upekkha on Github provides a handy list of mac models with the accompanying download link and more info.)

Apple does not publish that list since it is kind off back door to they service.

Here are few of them

2579 for Mac-F4218FC8 iMac6,1

2535 for Mac-F4218EC8 iMac5,2

2534 for Mac-F4228EC8 iMac5,1

2533 for Mac-F42786A9 iMac5,1