Sunday, January 15, 2012

Download and run Apple Hardware Test (AHT) from a USB drive.

Background (why I’m in this state)

I have a MacBook Pro 2,2 which came with Tiger. Then I upgraded to Leopard, then Snow Leopard and most recently, to Lion. For each of these upgrades I did a clean install, because I’d heard bad things about Ruby, CPAN, fink, MySQL and stuff getting munged. Effectively, I would wipe the old system and copy (not “Restore”) my old files.

The Situation (what didn’t work)

It seems like my GPU may be on its way out, so I wanted to run Apple’s Hardware Test (AHT). I don’t have my original system disks nearby, from which AHT could be run rather easily. Booting holding ‘D’ didn’t work, neither did F2 or Option+’D’, as some forums claimed. So I poked around and found that my /System/Library/CoreSerives/ didn’t have a .diagnostics directory (where AHT reportedly should be). This is probably because of all my clean OS installs. I found a place to download it (see below), but copying AHT into that .diagnostics directory still didn’t allow me to boot into AHT using the normal steps. I think this is because having cleanly installed Lion, it expects to use the new fancy internet-AHT like the MacBook Airs -- but the system ROM doesn’t trap Option+’D’ at start-up. So I still couldn’t get AHT to run. Here’s what I did to get it to run / boot from a USB stick.

The Method (what did work)

1) Download the AHT for your computer (see downloads below for specific models).

1b) My copy had me convert the downloaded .dmg from some “old” type using Disk Utility. (Just open the .dmg in Disk Utility and “Convert” to a new target, then mount the target.)

2) Mount and completely wipe a USB stick.

3) From the AHT image, copy /System to the root folder of your USB stick:

cd /Volumes/USB_STICK/ && cp -r ~/AHT_ARCHIVE/System .

4) Now, from the USB drive, copy the /System/Library/CoreServices/.diagnostics/diags.efi to the root directory:

cd /Volumes/USB_STICK/ && cp ./System/Library/CoreServices/.diagnostics/diags.efi .

5) Shutdown all applications.

6) “bless” the USB drive in mount-mode, with the EFI file, and immediately reboot:

cd /Volumes/USB_STICK/ && sudo bless --mount /Volumes/USB_STICK --setBoot --file diags.efi && sudo reboot

7) You should now be booting into AHT -- don’t hold down any keys.

8) Run the tests, and yank the USB key after AHT reboots you.


You can download the AHT package for your computer using this URL:

http://download.info.apple.com/Apple_Hardware_Test/018-[MODEL NUMBER]-A.dmg

where [MODEL NUMBER] is the four-number ID below:

3282 for Mac-F4208AC8, Mac-F42289C8 Xserve1,1 and Xserve2,1
3259 for Mac-F42C8CC8 MacBookAir1,1
3273 for Mac-F42C88C8 MacPro3,1
3254 for F4238CC8, F42386C8, F4218EC8, F4208EAA, F4208DC8, F4208DA9, F4238BC8, F42388C8 and F22788C8 inclusively.

or more specifically:
3085 for Mac-F22788C8 MacBook3,1
2886 for Mac-F4208EAA Macmini2,1
2845 for Mac-F42386C8 iMac7,1
2833 for Mac-F42388C8 MacBookPro3,1
2770 for Mac-F4238BC8 MacBookPro3,1
2769 for Mac-F4208DC8 MacPro1,1
2667 for Mac-F4208DA9 MacPro2,1
2766 for Mac-F4208CAA MacBook2,1
2592 for Mac-F42189C8 MacBookPro2,1
2591 for Mac-F42187C8 MacBookPro2,2
2590 for Mac-F4208CA9 MacBook2,1
2579 for Mac-F4218FC8 iMac6,1
2535 for Mac-F4218EC8 iMac5,2
2534 for Mac-F4228EC8 iMac5,1
2533 for Mac-F42786A9 iMac5,1
And these are there, but too old to identify: 2418, 2405, 2398, 2393, 2392, 2342, 2216, 2215, 2158, 2120, 2079, 2056, 1880, 1879, 1680 and 1594.

(Thanks to mkincaid at the macnn forum for that post.)

Enjoy!