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!

84 comments:

  1. Awesome post!

    What about the newest models missing from the list?
    I need the AHT for a Mac Pro (Mid 2010).
    I sorted it out the system model name, it should be "MacPro5,1 (Mac-F221BEC8)", but I don't know how to deduce the ID to use in the download URL. Any ideas?

    ReplyDelete
    Replies
    1. I tried the MacPro3,1 version on this same model and it wouldn't boot. I tried holding down 'D' as the included PDF suggested but no boot. Has anyone found the MacPro5,1 dmg?

      Delete
    2. While looking for my MacMini I did in fact find the one for MacPro5,1 to be 022-4831-A.dmg. Just use that file name in the same URL that was posted.

      Delete
  2. Yeah, those links are a bit of back-door, I think, for Apple Support and I can't find a real method to the numbering. So unfortunately, I have no idea where you can find the right version of AHT for an MacPro5,1. Apple might have the newer versions of AHT available publicly on their support site though.

    Best of luck.

    ReplyDelete
  3. I tried every other way to boot into AHT and this one was my last hope, but it just didn't work for me. It wont boot my thumbdrive even if I press D or C or Opt, and all there is in the usb stick is the System folder and the diags.efi from the AppleHardwareTest image I downloaded from the list in your post, corresponding to my iMac7,1.
    Is there another way to force it to boot from the usb stick? It does boot OSX Install images restored to an extermal hdd but I cant find or boot AHT from those copies either.

    ReplyDelete
    Replies
    1. Well, I think if you've followed the steps above, and have the correct version of AHT for your Mac, then it should work. The `bless` command is what forces the USB to be bootable (I think.)

      Delete
  4. Aww, hell, if I had this a month ago. I only check your blog every six months or so. xD

    ReplyDelete
  5. Ok, any suggestions if the CD/DVD drive is acting up? (Can't load anything. Hence the quest for AHT.) Anyway to push the AHT from the drive on my Mac Book Pro?

    ReplyDelete
    Replies
    1. So if holding `D` or `[option]+D` during boot doesn't work, try the steps above. But if you have a newer lappie, you can probably just download the regular AHT from apple, not the hidden ones I refer to above, and follow similar steps.

      Delete
  6. I tried this with my macbook 2,1 with no luck - just seemed to sit there and take forever to load the users.. hrmmm .. I think i better try and reinstall everything :p

    ReplyDelete
    Replies
    1. Sounds like it's trying to run AHT and failing. It might be the wrong version for your macbook, or maybe this method doesn't work for older machines... Hope this didn't waste too much of your time -- best of luck!

      Delete
  7. links for some newer models here:

    http://macforum.ro/topic/1194-apple-hardware-test/

    ReplyDelete
  8. links for some newer models here:

    http://macforum.ro/topic/1194-apple-hardware-test/

    ReplyDelete
  9. 2215 Worked on an iMac G5 20", A1076

    ReplyDelete
  10. How do I find the right Model Number for my Macbook Pro?

    ReplyDelete
    Replies
    1. I think this is what you're looking for: http://support.apple.com/kb/HT4132

      Delete
  11. THANK YOU! After hours and hours of struggle, I found this post and it set me free. Why Apple feels the need to hide all this from us is beyond me. It's totally crazy.

    Anyway, THANK YOU!

    Step #4 is missing something in the line command, but I figured it out.

    And thank goodness someone from Romania shared their link to the page with a more exhaustive list of EFI files to download. That was the last missing piece, once I had these beautiful instructions.

    HUZZAH, people, HUZZAH!

    ReplyDelete
    Replies
    1. Glad you got it work -- and hopefully AHT didn't find anything terribly wrong...

      Delete
  12. I will post this here so it's easier to find for others. You can find AHTs compatible with multiple Macs on this Romanian site:

    http://macforum.ro/files/category/11-apple-hardware-test/

    Unfortunately you have to register to download them, but you'll be able to figure it out.

    ReplyDelete
  13. worked for me on a mac pro 2,1

    thanks

    ReplyDelete
  14. Hey, Great Post! glad to see its working for some people!


    I'm Having some issues, any suggestions?

    I follow all directions to a T in terminal and am working with a freshly wiped USB stick, it does make it to a black screen with text flashing after the sudo reboot.
    Text Flashing Reads:
    """
    Can not open the file \diags.env Status: -2147483634, 0x8000000e
    Cab not open the file \Runtime_Files\Common\IndyErrors.h Status: -2147483634, 0x8000000e
    Error 0x8000000e loading /Runtime_Files/Common/IndyErrors.h
    Error: 0x8000000e, Couldn't load /Runtime_Files/EFI/Drivers/TestSupport.efi
    """

    Any help or suggestions would be much appreciated, thanks for your work again!!

    Machine Type
    iMac 4,1
    Serial W8603XBYU2N
    Tried files from Romanian site for iMac 4,1 and tried the same files in the same location on my original install media (Optical drive is shot in the iMac, Apple tells me I would need an 'Apple Approved" Firewire Drive in this case)

    Thanks again!

    ReplyDelete
    Replies
    1. Sorry for the delay -- been travelling a bit.

      It looks like you're doing the USB stuff correctly, but that AHT thinks there should be some files, which there aren't. Are you sure you have the correct version of AHT? Also, you might download Onyx (http://www.macupdate.com/app/mac/11582/onyx) and run the "fix permissions" utility.

      Delete
  15. Great Informations!
    Just tell me: How can I find the MODEL NUMBER for my MacBookPro6,2?

    Tanks a lot!

    Seb

    ReplyDelete
    Replies
    1. These instructions, I think, may only work for earlier models. But you can try this place: http://www.everymac.com/systems/by_capability/mac-specs-by-machine-model-machine-id.html

      Delete
  16. I've got a MacBookAir 3,2

    http://www.everymac.com/systems/apple/macbook-air/specs/macbook-air-core-2-duo-2.13-13-late-2010-specs.html

    I was able to download a file by filling in 2392 in your URL. But the resulting software was dated 2006. My MacBook Air was released in 2010 so I doubt I got the right one.

    Any idea what the right link is to download AHT for my machine?

    Thanks!

    ReplyDelete
    Replies
    1. So I /think/ the Airs use the internet-based AHT, nothing on disk or media. I don't think any of the links above will help. I think you should be able to boot up holding 'D'. But short of that, I really couldn't tell you.

      Best of luck!

      Delete
    2. Thanks for that response. My MacBook Air did come with a USB drive - I can't find it though. I think you're right about later models though.

      I was working with a 2nd level AppleCare tech the other day. She advised me to run the AHT. It won't work by holding down D because I'm on ML and there is no partition on my disk now with the test.

      Delete
  17. hi

    i did all the steps as you said. after "bless" rebooting again to osX and not in aht. check the link pls with my steps

    http://img10.imageshack.us/img10/5742/screenshot20130129at923.jpg

    tnx :)

    ReplyDelete
    Replies
    1. Does your USB stick have a light that might light up when you're booting? If it does, and it doesn't try to boot from the stick, it's something wrong with step 5. If it's trying to boot from the stick, and fail, then I think that means the version of AHT you downloaded isn't compatible with your machine. Maybe check the mdoel? Or, for newer modes you might apple's mainline support sites.

      Sorry I'm not more help...

      Delete
  18. Hi, you made my day today (feb, 11th 2013). I was near to hopelessness to find HW Test ... but your article rocked!
    I couldn't boot from another usb pen drive with the Mountain Lion InstallESD.dmg restored onto it, BootManager didn't see it. But your procedure made MBP boot from the drive and the HW Test program started.
    My MacBook Pro Intel Core2Duo 2,2MHz (model A1226) and used the 2770 image (Apple HW Test Version 3A121), which was accepted by my MBP - test is now running!
    Thanks a lot!!!

    ReplyDelete
    Replies
    1. Happy to help! Hopefully the tests don't find anything scary...

      Delete
    2. Yay ... NO TROUBLE FOUND (after 1h 20min -extended- testing).
      :-D

      Best regards and Thanks again!

      Delete
  19. Hi Rivenx5

    Your really going to have to help me out here

    Where or how do you find the code identifier begging with F?

    What or where am i looking for this?

    I can find apple model no which is a1226 i have looked through system profiler & i have also used the link you posted earlier in the comments but i cannot find any reference beginning with F

    Please help

    Thank you

    ReplyDelete
    Replies
    1. Hey, so I'd try poking around here:

      http://macforum.ro/topic/1194-apple-hardware-test/

      or here:

      http://www.everymac.com/systems/apple/macbook-air/specs/macbook-air-core-2-duo-2.13-13-late-2010-specs.html

      They should at least list your model number. Keep in mind you'll only need to do this nonsense if you have an older mac. The newer ones should have AHTs on apple's support site.

      best of luck!

      Delete
  20. Hi Thank you for the quick reply rivenx5

    I do know how to get the model no ETC how are you getting the code beginning with F?

    I'm not searching specifically for my personal Mac i have had a couple of times where i could have done with running a diagnostic on Macs i have been working on & the original installation disks were not available the only answer i get from Apple is to buy the disks again

    Something like this would be a godsend if i knew how to find the the Mac-f**** for the mac i'm working on

    Cheers

    ReplyDelete
    Replies
    1. Sorry to say, but I really don't know... If you know your open identifier, like Macbook 2,1, MBP3,2, etc... you can probably look around for an AHT version with that. But I'm oddly not sure how to find the Fxxxxxx identifier. Sorry I'm not more help!

      Delete
    2. One way of getting the Fxxxxxx identifier is to run geekbench (if the mac is able to boot in the OS), that number is the motherboard model in the geekbench report.

      Had to use this method as there are 3 different AHT's listed for an iMac7,1

      Delete
    3. Nice Jeff, thanks!

      Here's a link: http://www.primatelabs.com/geekbench/download/mac/

      Delete
    4. ioreg -l | grep board-id

      Delete
  21. Thanks! This worked perfectly. Had to do a lot of Googlimg to find the link for A1278/MacBook5,1 though:

    http://download.info.apple.com/Apple_Hardware_Test/022-4048-A.dmg

    https://plus.google.com/app/basic/stream/z12uinrhntu5srbmx23gydlhbnzaedh2g

    ReplyDelete
    Replies
    1. Awesome -- glad it worked. And thanks for the links!

      Delete
  22. I have a iomega external hard drive and I recently discovered that it's corrupted. There is some data on there which is important and the "mac disk utility" can't repair it. I need a free software (not limiting demos) that can do either of the following: Transfer files from my external hard drive to my mac repairs the hard drive without erasing the data

    ReplyDelete
  23. Hey Rajesh -- sorry to say, but I haven't the least bit of experience with this. The techs I used to work with used a Knoppix repair disk on everything (even macs) to clone the drive to somewhere they could fix it. Still know what that really means, but this site looks promising:

    http://www.brighthub.com/computing/linux/articles/64736.aspx

    The good thing about sticking with Knoppix or something linux is that it has lots of tools which are free and powerful. The bad is that if you're not an expert with unix-like stuff, it might be complicated.

    Also, did you /try/ running AHT? Not sure if it will do much, but you might try it with your external drive plugged in and see if it finds / fixes anything. Sorry I'm not of more help -- and good luck!

    ReplyDelete
  24. Is it just a case of dump your command lines shown above into Terminal because my flash drive doesn't appear to have anything on it and i get "Can't statfs diags.efi". Any help greatly appreciated.

    ReplyDelete
    Replies
    1. Hey Jason -

      In step 4, try `ls ./System/Library/CoreServices/.diagnostics/` and look for diags.efi. If it's there, something is seriously horked up (maybe a full drive or bad read/write permissions?), and if it's not, then either a) you've got a bad version of AHT or b) you've the right one, but this method doesn't work for your model / version.

      Delete
  25. Mac Pro 1,1 upgraded to 2,1, what is going to be the correct dog file ?
    I downloaded both the 1,1 - 2769 & the 2,2 - 2667 files. You open the files & it shows /System/Library/CoreServices. [.diagnostics is not there ]

    ReplyDelete
    Replies
    1. Hi Professor -- so the .diagnostics file is a hidden file, meaning it won't show up in Finder, but in a terminal you can type `ls -al` which should show it if it's there. If it's not, then the older models were doing something different than this... In step 4, do you get an error?

      Also, the model (1,1 or 2,1 etc...) is your hardware's model, and not upgradable. You should definitely download the AHT version for your hardware.

      There also might be a readme file that came with the AHT you downloaded -- might have more instructions.

      Delete
  26. Note: if you DO have a working CD-ROM drive, you can simplify this process: just find the right download, open the .dmg in Disk Utility, burn it to a CD, then boot from the CD by holding down the "D" key -- no command-line stuff at all. I just wish Apple would make all of these downloadable AHT's visible, ideally tied to a "type in your serial number" form.

    I've just acquired a late-2006 iMac 5,1; there are two downloads in the list that say "iMac 5,1", and #2533 didn't boot, but #2534 worked fine. And AHT didn't find any problems with the hardware (which leaves me trying to figure out what else is wrong :-)

    ReplyDelete
    Replies
    1. Thank you!!

      I was having trouble making sense of the the instructions for a USB drive above. Burnt the app to CD and booted up as you mentioned... it worked fine.

      As a side note:— surely the lack of freely available AHT downloads is down to Apple taking every opportunity these days to drive you to their tech support, where they charge outrageous prices to perform fairly basic repairs...

      Delete
  27. What is the number to download for a MacBook Pro mid 2009 13 inch? I cannot find the aht download :(. It is also known as MacBook Pro 5,5

    ReplyDelete
    Replies
    1. Hey, so I think the newer AHT versions on available on Apple's support site -- you might have a look there. And if you haven't done a clean re-install of OS X, you should be able to boot in AHT by holding the D key.

      Delete
  28. I could find the number of my white 2009 Macbook (F22788AA) using Geekbench yet can't find a corresponding AHT file. Any idea ?

    ReplyDelete
    Replies
    1. Yeah, take a look at Apple's support sites -- I think they have the newer versions of AHT available there.

      Delete
  29. Hi,

    what would be the number (link) for MacBook Pro 7,1 (mid-2010)?

    ReplyDelete
    Replies
    1. did you find this? I'm looking for macbookpro7,1 AHT as well.

      Delete
    2. Hey, I am also looking for this one.

      Delete
    3. Me too, looking for the MBP 13" 7,1 number !

      Delete
    4. 022-4653-A.dmg is the file for MacBookPro7,1

      Delete
  30. I am having trouble getting an iMac 27 inch EMC 2390 working. I can;t get the AHT file from the site. A1312

    ReplyDelete
  31. I have an iMac 11,1, and was tearing my hair out because, while I have the CD with the program on it, my internal Superdrive is toast. I have an external Superdrive, but AHT won't run from there. So, I was in the happy situation of having the right version (no need for a cryptic type-number search); but had no chance to actually *run* it. So, using your instructions, I was able to copy from the CD to my USB stick. Worked like a charm!!! Thank you!!!! (And no hardware problems found- now time to troll through the software. ewwww.)

    ReplyDelete
    Replies
    1. Glad it worked! ...and good luck with the softer side of things...

      Delete
  32. I needed the AHT-Image for MacbookPro5,3 and found none.
    So I grepped the apple download server for more images and found these.
    Have fun!

    http://download.info.apple.com/Apple_Hardware_Test/022-[NUM]-A.dmg

    where [NUM] is the four-number ID below:

    4266 for Mac-F42D86A9 - MacBookPro5,1
    4267 for Mac-942C5DF58193131B - MacBookAir3,2
    4292 for Mac-F22C86C8 - Macmini3,1
    4293 for Mac-F2218EC8 - iMac9,1
    4294 for Mac-F2218FC8 - iMac9,1
    4297 for Mac-F2218EA9 - iMac9,1
    4299 for Mac-F22788AA - MacBook5,2
    4339 for Mac-F2268AC8 - MacBookPro5,5
    4343 for Mac-F22587C8 - MacBookPro5,3
    4344 for Mac-F22587A1 - MacBookPro5,4
    4451 for Mac-F2268CC8 - iMac10,1
    4452 for Mac-F2268DC8 - iMac10,1
    4453 for Mac-F22C8AC8 - MacBook6,1
    4596 for Mac-F22589C8 - MacBookPro6,1
    4597 for Mac-F22586C8 - MacBookPro6,2

    ReplyDelete
    Replies
    1. I have a MacBookPro6,2 and cannot get AHT to run. I have tried running it from both CD and USB drive, are you SURE that 4597 is the correct version?

      Delete
    2. Yep, it contains the Mac-F22586C8 folder thats used for MacBookPro6,2 - the folder name equals the name of the motherboard version. You could also try AHTInstall4.pkg from Jasric89, the package contains some more recent versions of the AHT: https://discussions.apple.com/message/18589412#18589412

      Delete
    3. rob, can you explain how to "grep apple's download servers" and @Rivenx5, upgrading a MacPro1,1 to a MacPro2,1 actually is possible: http://forum.netkas.org/index.php/topic,1094.0.html

      Delete
    4. http://forum.netkas.org/index.php?topic=5454.0

      Delete
  33. Same question as above. What about iMac8,1? Can't find any original discs for my imac - last option is hardware test before opening up and poking around or dropping it off for service out of warranty (trying to avoid). Much appreciated.

    ReplyDelete
  34. What about MacbookPro5,2?

    ReplyDelete
  35. Thank you for sharing this information. The information was very helpful and saved a lot of my time.

    ReplyDelete
  36. https://github.com/upekkha/AppleHardwareTest
    has some others not listed here

    ReplyDelete
  37. Anyone got MacBookPro8,3?

    ReplyDelete
  38. Good informative read, Thank you so much for nice information….. For more details and iMac price in India.... click the link apvision.in imac price in india

    ReplyDelete
  39. We bought a used mid-2010 MBP and needed to know if an update or the hardware was causing reboots. This process helped getting the diags to run. Thanks!

    Patiently waiting for the tests to finish...

    ReplyDelete
  40. Hey, great guide, worked fine for old PowerPC based mac and newer Macbook 2,1 && 2,1 && MBP 3,1.

    Note for users, don't forget to make sure your USB is partitioned with the correct type, under partitions / options, read the descriptions as they vary for bootable drives...

    But on each system I've tested it seems only the RAM tests are available... Boots into AHT fine but under HW tests there's no mention of any other HW... The extended test and standard only report back RAM tests.... Anyone else noticed / getting this? I wonder if it's a permission thing so going to try restoring the AHT boot mode as im working off a MBP 3,1 under Snow Leopard at the moment...

    Thanks!

    ReplyDelete
  41. Quick further comment: my suspisions were right, as soon as i restored the diagnostic folder to the sytem HDD and booted into AHT following this guide-
    http://hints.macworld.com/article.php?story=2011080811033562
    All tests reappeared and i could test as usual. Note though that early in on Lion this method will not work, if that is you've upgraded your system to lion.

    ReplyDelete
  42. This so helped me! Thank you!

    ReplyDelete
  43. This site was... how do you say it? Relevant!!
    Finally I've found something that helped me. Thanks a lot!



    Here is my webpage thick hair

    ReplyDelete
    Replies
    1. l need AHT for MacBook Pro 4,1 (early 2008) I'm having trouble finding it can anyone help me?

      Delete
  44. https://github.com/upekkha/AppleHardwareTest
    Here you have all versions of AHT. I use the MacBook Pro 4.1 version and it run ok. Great job.

    ReplyDelete
  45. HI there * Rivenx5 *,
    I have all those versions of AHT-
    Mac OS version 10.5.4
    AHT version 3A152
    Mac OS version 10.5.2
    AHT version 3A140
    AHT version
    3A174
    3A197
    3A150
    3A190
    3A153
    3A210.

    But i don't know which one is for my mac. :(
    How can i find which one is for which mac? Is there list of all AHT versions?
    Ty in front :)

    ReplyDelete
  46. This is a topic that's near to my heart... Take care!
    Exactly where are your contact details though?


    My webpage; phthisis

    ReplyDelete
  47. A list of AHT download links:
    https://github.com/upekkha/AppleHardwareTest

    ReplyDelete

Keep it real