Thoroughly testing your Mac's RAM – an up-to-date how to (2016; macOS Sierra-tested)

3 October 2016, 13:44

Feature head image

Testing a Mac’s RAM is a difficult task because several apps people used to rely upon are old, and no longer guaranteed to work. Apple has also removed the more thorough boot-time diagnostic app on newer Macs.

Here’s a way to test a Mac’s RAM that’s been tested on an up-to-date model MacBook Pro running macOS Sierra. The steps might seem complicated but are actually pretty simple to follow. Print them off if needed.

1. To get the piece of software we want to use for testing we first need to install the Homebrew subsystem of command line tools. Don’t worry – this is invisible during everyday use and takes up hardly any space on your disk. To install it open a Terminal window – which you’ll find in the Utilities folder of the Applications list of Finder – and paste in the following:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Note that although this might appear as several lines on this website, it’s actually a single line command – triple-click to select it, then copy it, and paste it into the Terminal window via Ctrl+V.

2. Once that command has finished working its way through, we next need to install the app we’re going to use for this test – memtester. Paste the following into the Terminal window:

brew install memtester

3. Now we need to boot the Mac into single-user mode, which is a stripped down version of macOS/OS X. To do so, reboot as usual and when the Apple logo appears hold down Cmd+S until a command prompt appears (note: If you have a firmware password set you’ll need to disable it temporarily and if you have FileVault activated then you’ll need to hold Cmd+S before and after typing your boot time login password).

Lots of text will flow past on the screen as you boot into single-user mode, a bit like when Linux boots, but you can ignore it.

4. Type the following at the command-line prompt when it appears:

top -l 1 -s 0|grep PhysMem

Main feature illustration

This will report a figure something like the following:

807M used (795M wired), 7G unused

We’re interested in the figure at the start of the line, which in the example above is 807.

5. Grab a calculator because it’s time for some basic math! Start by multiplying the number of gigabytes of RAM in your computer by 1024. For example, if your Mac has 8GB of RAM then this would be 8 × 1024 = 8192. Now subtract the figure you discovered above. In my case this would be 8192 – 807 = 7485. Finally, replace the right-hand two digits of the outcome with zeros. Continuing our example, that leaves us with 7400.

7. Back at the command line, type

memtester

… followed by a space, and then the figure you worked out above, followed by M. Then type a space again, and then simply 1 (that is, one, not the letter L). To continue our example above, we would type the following:

memtester 7400M 1

8. Hit Enter to start the test.

Now you must wait. The memory test will take an hour or two to complete and it’s likely your Mac’s fans will spin-up while it does. You’ll see a progress display as it works through the tests.

If the memory is OK the app will return you to the command prompt with “Done”, with an “OK” after each of its tests. That means the tests were carried out without errors. If you see x02 or x04 then sadly your RAM has issues. Similarly, if your Mac crashes, reboots or freezes then it’s likely the RAM is at fault, although this might also be caused by an overheating issue or poor fan cooling.

Main feature illustration

(Note that messages about “SmartBattery” can be ignored. This is merely the MacBook’s battery recharging or the charger being attached/detached.)

To reboot your system to the standard desktop just type exit. If you need to quit the test while it’s running tap Ctrl+C, wait a few seconds and then type exit.

Using memtester isn’t 100% perfect because it only tests free memory, and not all memory, because a fraction of that – likely to be around 700MB on most systems – is used by macOS itself. However, if that patch of memory was faulty then it’s likely macOS wouldn’t be able to boot in any event.


.



,

---

Leave a comment...

Step one returns “Illegal variable name.”

I tried with and without the close quotes. Thoughts?

— Paul R · Oct 3, 08:16 PM · #

Paul it worked for me, at least step one anyways. I typed it in manually tho, maybe try that? Just double check your writing.
Anyways, I’ve got 16gb of ram and I’ve been running this test for like….6 hours now. Idk if I’m that dedicated any longer.

Thanks for the article tho! :)

Evan W · Oct 3, 09:59 PM · #

Paul, just try visiting the Homebrew home page and following their instructions:

http://brew.sh

However I just tried it again as it appears above and it works fine for me too. You really need to copy and paste this, rather than copy type it!

Keir Thomas · Oct 3, 11:34 PM · #

What about an app like Techtool Pro? Can you perhaps tell us alternatives to the homebrew method (even if they are paid like Techtool). Thanks!

— Alex · Oct 8, 10:53 AM · #

Just a note of “simple math” 8192 – 807 = 7385, not 7485 ;)

Jovan Hernandez · Oct 10, 10:18 AM · #

 
---