Testing RAM on a Macbook Pro

Print Friendly

My Macbook Pro came with 4GB of RAM in 2 2GB modules.  In December, I ordered 8 GB (2 4GB modules) of RAM from Crucial so I could max out the RAM in the machine, as I intend to keep it for a while.

Early in January I started to see applications crash.  VMWare Fusion became almost unusable.  I had never seen this behavior from my Mac before, so figured the new RAM had something to do with it, but wanted to verify my assumption before blindly blaming Crucial for bad RAM.  At that point I had to learn how to best test RAM on a Mac.

On a PC, I would have booted a CD running memtest86, but none of my Internet research indicated that was possible for the Mac.

Instead, I had to install memtest and boot the machine into single user mode in order to run memtest with the least amount of interference from running programs. I wanted to document what I had done in a blog post so I could remember next time.

Note: This article involves configuring your Mac in a way that could make it difficult for you to boot it normally if you don’t know what you’re doing. If you don’t feel comfortable following these instructions, take your Mac to a technician who not only feels comfortable fixing your computer, but is also competent to do so.

To tell the Mac to boot into verbose 64-bit single user mode, go to Applications/Utilities/Terminal, and type:

sudo nvram boot-args="-s arch=x86_64 -v"

You may be asked for the password you type to make changes to the system, type the password and hit enter.

Reboot your Mac.

Your Mac will boot to a prompt.  You may be surprised at all of the text that goes by.   These are kernel messages that are normally hidden by the nifty Apple logo.

At the prompt type:

memtest all

This will attempt to test as much RAM as it can.  Remember that some of your RAM is being taken up by minimal amount of software that booted your machine into single user mode (the kernel and bash), so you won’t be able to test everything, but if the flaw was in the RAM being used by the software running at this point, the machine would have failed to boot.

If your RAM is good, the test will take hours and you will see something like:

Memtest version 4.22 (64-bit)
Copyright (C) 2004 Charles Cazabon
Copyright (C) 2004-2008 Tony Scaminaci (Macintosh port)
Licensed under the GNU General Public License version 2 only
 
Mac OS X 10.6.6 (10J567) running in single user mode
Memory Page Size:  4096
System has 2 Intel core(s) with SSE
Requested memory: 7555MB (7922552832 bytes)
Available memory: 7555MB (7922552832 bytes)
NOTE:  Memory request is too large, reducing to acceptable value...
Allocated memory:  7343MB (7700721344 bytes) at local address 0x00000000101000000
Attempting memory lock... locked successfully
Partitioning memory into 2 comparison buffers...
Buffer A: 3671MB (3850360672 bytes) starts at local address 0x0000000101000000
Buffer B: 3671 MB (3850360672 bytes) starts at local address 0x00000001e67fd760
 
Running 1 test sequence... (CTRL-C to quit)
 
Test sequence 1 of 1:
 
Running tests on full 7343MB region...
  Stuck Address       : ok
  Linear PRN            : ok
Running comparison tests using 3671MB buffer...
  Random Value        : ok
  Compare XOR         : ok
  Compare SUB         : ok
  Compare MUL         : ok
  Compare DIV          : ok
  Compare OR           : ok
  Compare AND         : ok
  Sequential Increment:ok
  Solid Bits               :ok
  Block Sequential      :ok
  Checkerboard         :ok
  Bit Spread             :ok
  Bit Flip                  :ok
  Walking Ones         :ok
  Walking Zeroes       :ok
 
All tests passed!  Execution time:  7068 seconds.

If your RAM is bad, you will likely get a response really fast, and you will see something like:

*** Address Test Failed *** One or more DIMM address lines are non-functional.

or

FAILURE: possible bad address line at offset 0x06b3a4c8.

or

FAILURE: 0xbea1ce76 != 0xbea1ce7e at offset 0x06b3a4c8.

or

*** Memory Test Failed *** Please check transcript for details.

If you get a message like:

Attempting memory lock... ERROR: Memory lock failed - reason unknown.

WARNING: Testing with unlocked memory may be slower and less reliable

hit CTRL-C and make sure you booted into 64-bit mode by typing the following:

uname -m

If the command doesn’t return x86_64 then you are not running in 64-bit mode and your Mac can’t reach the RAM above 4GB. Please reference the above command for booting your Mac into single user mode, as it includes the flags to set it to 64-bit mode, then reboot.

If the command above does return x86_64, then you are running in 64-bit mode and this message is probably a preview of test failures to come.

If you have more than one module of RAM, then take all of them out, and place one in the machine, boot, and run the test. After that one finishes test, note the results, turn the Mac off, take the RAM module out, and put the next one in. This way you can figure out which module is bad.

When done, make sure you have good RAM in the machine, boot it again, and type:

sudo nvram boot-args=""

This will give you your “normal” Apple logo screen on boot.

I hope you will find this article as useful as I will the next time we need to test RAM on a Mac.

Today, Crucial was nice enough to send me some new RAM after I sent them the bad module.  So far, it appears to be passing memtest.  Cross your fingers for me!  :)

34 Responses to “Testing RAM on a Macbook Pro”

  • Roger:

    Thank you so much for this page. I had a had problems working out the memory locking message, but you have it all documented here.. Nice job!

  • Marc:

    Thanks a lot for the information. All of the other websites I found failed to mention the memory lock message, but it worked for me here. Much appreciated.

  • Michael:

    Thanks very much. Really couldn’t find out how to boot in 64bit single user mode!

  • Dillon:

    What do you do if the test freezes up during the process? I am running 4.22 in 32-bit mode. My machine is a Power Mac G4 1.42 Dual Processors MDD. My happens to freeze up at…

    walking zeroes :setting 54 of 64

    What should I do?

  • Dillon:

    Just tested the same ram module twice. By itself and this time it passed. What does that mean? I’m testing a 512MB module.

    • That’s a bit odd Dillon. It can be difficult to determine if it’s still checking or it’s locked up. How long did you let it run the first time? I know I kicked mine off and went to bed.

      Did it fail the first time, or did it freeze up in the middle?

      It should have blown through 512MB pretty quickly. What kind of Mac were you running it on?

  • Dillon:

    My machine is a Power Mac G4 1.42 Dual Processors MDD. It’s older. The PowerPC G4 processors are 32 bit. You can tell if it locks up by how it flips the text back and forth, testing/setting.
    If it keeps cycling between testing and setting, your good, but if it locks on to just one of them for like 5 minutes, it froze.

    I visited this blog link…
    http://osxdaily.com/2011/05/03/memtest-mac-ram-test/
    and it states that if it freezes that’s a good sign of bad ram. I however would think it would freeze in the same spot on every test for that ram module.

  • Dillon:

    It so far has never failed a test, it has passed a few and other times has froze in the middle.

    • Perhaps it’s the motherboard. My brother-in-law lost his G4 more than two years ago because the motherboard gave it up.

      Based on what I’ve read about memory problems, the inconsistent test results can be caused by bad voltage settings or bad timing settings. This makes sense because of the way RAM works, using capacitors to store bits, I could see how the wrong voltage settings might cause havoc.

      I’m assuming no one has been modifying the voltage or timing settings for RAM on your Power Mac, so that leaves either the power brick or the motherboard as the culprits.

      I know it’s not much of a comforting suggestion because the motherboard effectively is the computer.

      When my brother-in-law took his G4 to the Apple store, they told him he needed to buy a new one. I hope I’m wrong in your case.

  • Dillon:

    Brutal!

  • Dillon:

    Back again with updated news! Lets start with the good news. It’s not the hard drive. I tried my old hard drive and it worked great for about 2 days and then it started hard freezing again. So I called a local mac tech and explained the situation and he said sounds like the bad ram, but could be the logic board.

    So I decided to take my 512mb stick from the 1st slot and move it to the second slot. 4 days later computer is still working great.
    So the bad news is the logicboard is at fault. Slot (J21) will register memory, but something with that slot causes hard freeze issues. I found replacement boards on ebay for less than 20 bucks so there is hope. But I’m gonna try cleaning the slot first. What should I use? With machine unplugged of course!

  • Dillon:

    Cleaned the slot, didn’t work! Reset the PMU switch, works great! FIXED!

  • Mico:

    Great blog, after following the instructions, I was able to fully test my new memory (upgraade my system from 4gb. to 8gb.). My new dilemma now though is it keeps on booting back to the terminal screen even after inputting the last command line given above? Although it does say to enter exit to boot the system, but after restarting it again, it still boots back to the terminal prompt.

    Thanks.

    • That’s strange. I’m assuming it never gets to the graphical screen at all.

      The -s is for single-user mode, meaning it boots into the terminal. It sounds like that’s still set.

      Try running sudo nvram -p | grep boot-args to see what is set. If you see something like boot-args -s then you need to run the sudo nvram boot-args="" command (nothing, not even spaces, should be in between the quotes). That command effectively empties the boot-args firmware variable.

  • Crunch:

    Any of you use “Rember”? It’s basically memtest with a pretty face, i.e. a GUI that you can run within OS X. I put 2x8GB sticks in my 17″ MBP (Late-2011), which supports 16GB, not just the 8GB that Apple would have you believe. I just wanted to make sure that the RAM was good, so I let it run through just 1GB, as I was already using around 8GB and still wanted to use the system.

    So far so good, but I want to go all the way. How many “loops” do you suggest running the test through? Also, it’s got 9-9-9-25 timings. All other RAM in my previous 2011 Mac’s were 9-9-9-24. Do I care, do I worry, or do I install Win 7 x64, dedicate 8 gigs to it and run some sick game at high settings inside a virtual machine?

    • I wanted to test the RAM in an environment of lower entropy than a full GUI boot would produce. Rather than going through all of the system services and stopping them, I opted for single user mode instead.

      In order to limit the possibility of the OS allocating RAM while I do the scan, I avoided tools like Rember. I didn’t want some other process to lock up the system before the memory scanner got to the bad spot in RAM. This way the memory scanner can report on which slot or module is bad.

      I’m not saying Rember isn’t as good as memtest (it runs memtest under the GUI), just that a better test can be achieved in single user mode.

  • JC:

    Thanks for this great tutorial. I was trying to get memtest86+ running form a USB-Stick and CD for hours without success. Then I managed to start it by using a Linux Live CD for booting. But as memtest86+ found thousands of errors, I did some research and found some hints in the internet that memtest86+ is not working correctly on Macbook Pros (mid 2010).

    I was about to give up when I found your article. Finally I was able to install memtest on OS X and test the RAM in single user mode. It seems to be that the RAM is not faulty. Now I have to identify why my system is crashing so often. I will contact Apple Support.

    Thanks again!

  • Ynot:

    Thanks for the article Shawn, much appreciated.

    Okay, so I’m running Memtest on a 2006 Mac Pro in Single User and 64bit. It has 20gb of RAM. Although it’s running in 64bit I still get the error:

    “memtest attempting memory lock… error: memory lock failed”

    What can I do to run through all the modules? If I take some modules out, don’t I have to leave a pair in at a time in a 2006? Also, I have 2gb modules and 4gb modules. If I have to run in pairs that = 8gb at the least for the 4gb modules (2×4). Is that too much for memtest?

    Thanks.

    • I’m not sure what to tell you about a 2006 Mac Pro, but I’ll try.

      Are you sure it is running in 64-bit mode? I messed it up the first time I rebooted.

      I remember ye olde PCs required pairs of RAM modules to match, but I’m a little surprised that such a recent Mac Pro has that requirement.

      I’ve looked for anything talking about upper limits for memtest and haven’t found anything.

      Out of curiosity, what version of OSX is it running?

  • Marc:

    For some reason, when trying to get back to “normal” mode,

    sudo nvram boot-args=”"

    did not work for me. I got a “sudoers resources not available” or something like that

    nvram boot-args=”"

    (just without the “sudo”) did the trick for me

    • I’m glad that it worked without the sudo, but I’m concerned that your sudo installation is broken.

      sudo uses a file named /etc/sudoers to determine which users can run commands with administrative privileges. If that is missing and you didn’t delete it, then something might be wrong with your OSX installation.

      The fact that the nvram worked without the sudo leads me to wonder if you are running as root all of the time, which is quite dangerous.

      What version of OSX are you using?

  • Justin:

    Hi,

    I’ve ran MEMTEST for hours and it’s just stuck on “Test sequence 1 of 1: ”

    i’m using a macbook pro i7 8gb ram, however, the performance is VERY sluggish, I can type two or three lines before the word shows up. Checked my hard disk and it’s completely OK. (compared the hdd test with my friend who’s on a lower spec and my results are way better than his).

    Can you suggest anything that I can do? Seeing that memtest is kinda stuck, can I safely assume that my macbook is running slow due to bad RAM?

    • If it gets stuck on the MEMTEST, then I’d say it’s highly probable that you’ve got bad RAM, or the motherboard is having issues.

      If you have more than one stick, try MEMTEST on the sticks one by one. If you have one stick, try buying another one (you can likely return it if you find out that’s not the problem).

      Also, you are running this in single-user mode, without the GUI running, right? Single-user mode reduces the number of processes that are running in the background. If you’re not running the MEMTEST in single-user mode, then a runaway process may be making your Mac sluggish. An i7 MBP with 8GB of RAM should not be sluggish.

  • dell:

    Hi,
    Im having a late 2011 mac pro 13″ i5 with 8 gb ram installed and running mountain lion on it, lately i’ve been facing problems such as it boots up to an grey screen with three beeps, then when you try to boot it up again after two or three attempts it boots up fine and workes fine without any problem untill the next time i boot it up after a few hours.
    Now i followed your instructions for the memtest, but at the prompt when i enter memtest all it returns saying the the command does not exist, iv’e tried uname -m just to make sure it runs in 64 and it returns x86_64.
    Can you suggest what might be the problem, please…

    Thanks,

    • The memtest utility doesn’t come with OSX. In the article, I state “I had to install memtest”, and link to where you can get a packaged copy of it: http://www.command-tab.com/2008/01/11/how-to-test-ram-under-mac-os-x/

      If you can’t boot the mac, it will be difficult to put memtest onto the Mac. Good luck.

      • dell:

        Hi,
        Sorry for the trouble, i realised it later after i posted it,Anyways i managed to install it and checked both my memory sticks Individually as well as together, both the time it passed all the tests, but still whin i turn on my laptop after its been shutdown for quite some time it starts giving the three beeps at start up and wont boot, then you just remove the ram and put it back again and it works fine, then i tested it with just 1 slot populated and it works fine with both the ram cards, then i populated both the slots with the original ram that came with the laptop and it works fine with out any problem.
        Now im confused both my 4gb rams works fine individually both my slots on the mother board work fine, bu somehow both the 4gb ram together dosent seem to work whereas they used to work without any problems before.
        Any sugestions.

        Thankyou once again.

  • Maurits:

    I have MacBook Pro 15 inch 2011 with 4 gb of RAM. My Mac crashes often after I quit a game like minecraft. After a start up it beeps 3 times with a pause and then 3 beeps again. I think it’s something with the RAM but I when I run memetest it doesn’t come up with anything and I also tried apple hardware test and no trouble found either. I have a windows partition on my Mac and it runs smoothly, no crashes even playing games like minecraft and just cause 2. If it is a RAM problem how come it only affects my Mac partition?

    • Cleber:

      It is possible, however unlikely, that you might have a RAM problem in the area that doesn’t get tested by the app (there is generally a small portion that doesn’t get tested). If you are comfortable opening up your MBPro, try swapping the sodimms (put the lower one on the top slot and vice versa). Of course, use static electricity and other usual precautions when handling the memory cards. Of course, that is assuming you have 2x2GB sodimms and not just one 4GB stick.

      I have found in a couple of cases that this has led to errors being found. Might be worth a try.

  • anon:

    hi, I was able to get into the single mode but when I type the memtest all, nothing works.. it’s days command not found

  • James:

    Thanks! This helped!

Leave a Reply