ClearDisk
Buy for $10Download ClearDiskDownload
A LITTLE MORE CLARITY

What to use instead of the Linux free command on Mac

macOS does not include the Linux free command, which is why running free in Terminal returns “free: command not found”. Instead, run top -l 1 | grep "^PhysMem:" for a one-line RAM summary, sysctl hw.memsize vm.swapusage for total RAM and swap, or vm_stat and memory_pressure for page-level memory diagnostics.

1. Get a one-line summary with top

Linux’s free prints total, used and free memory in one small table. The nearest thing on a Mac is top in logging mode: -l 1 takes a single sample and exits instead of opening the live screen, and grep keeps only the memory line. A read-only check on macOS 27.0.1 returned “PhysMem: 116G used (5944M wired, 165M compressor), 12G unused.” This is one machine’s observation, not a target for yours; the values change as apps run.

Used covers memory apps hold, wired memory the system must keep in RAM, and the compressor, which stores squeezed pages in RAM instead of writing them to disk. Unused is RAM holding nothing at all. macOS also keeps recently used files cached in spare RAM. A small unused figure alone cannot tell you whether the workload is short of memory.

top -l 1 | grep "^PhysMem:"

2. Add total RAM and swap with sysctl

On macOS, sysctl exposes installed RAM and swap separately. hw.memsize returns bytes; dividing by 1,073,741,824 gives gibibytes (GiB), not decimal gigabytes (GB). The second command prints one decimal place. Our check returned 137438953472 bytes, or 128.0 GiB. vm.swapusage reports swap total, used and free; our sample showed zero for all three.

Swap on a Mac isn’t a fixed partition. macOS creates swap files on the startup disk as it needs them, so the total grows and shrinks, and a few gigabytes of swap in use on a busy day is not a fault on its own. The swap guide explains where those files live and when swap is a warning sign.

sysctl hw.memsize vm.swapusage
sysctl -n hw.memsize | awk '{printf "%.1f GiB\n", $1 / 1073741824}'

3. Read vm_stat, and convert pages to bytes

Read the page size in the first line of vm_stat instead of assuming a value from the chip type. pagesize provides a separate check. Our run reported 16384 bytes. For a row measured in pages, multiply its count by that size to get bytes, then divide by 1048576 for MiB. For example, 1024 pages at 16384 bytes per page is 16 MiB; this arithmetic example is not a measurement of free RAM.

Free, active, inactive and wired are memory-state counts. Wired pages cannot be paged out. Pages occupied by compressor measures the space holding compressed data; Pages stored in compressor counts the pages represented there. Do not add every row together: some describe overlapping classifications, and rows such as Translation faults count events rather than a current amount of RAM.

vm_stat -c 3 1 takes three samples one second apart. In our test, free and active remained current page counts while faults and pageins became interval event counts after the first sample. The installed manual describes interval differences broadly; do not subtract or convert every column as if it had the same meaning. Control-C stops a repeating command.

pagesize
vm_stat
vm_stat -c 3 1

4. Use memory_pressure as a separate diagnostic

With no options, memory_pressure printed aggregate memory counters and “System-wide memory free percentage: 94%” in our macOS 27.0.1 check. That percentage is not a documented substitute for Linux’s available column or a promise that an app can allocate that much RAM. Do not turn it into a pass/fail threshold. Use Activity Monitor’s graph and the symptoms of your actual workload.

Run only the no-option form shown here for this check. The manual documents -l and -p as pressure-generating options and -S as simulated pressure. Those modes alter system conditions and are not part of this guide. We did not run them.

memory_pressure

Why free memory looks low, and what to watch instead

macOS uses RAM for file caching and can compress memory or use startup-disk space for swap. Apple’s Activity Monitor guide makes the point directly: having free or unused memory doesn’t necessarily improve performance. A small unused figure from top, or a low free count from vm_stat, is not a reason to act.

The figure that tells you whether the Mac is short of memory is the Memory Pressure graph in Activity Monitor’s Memory tab. Apple describes green as RAM being used efficiently, yellow as a sign the Mac might eventually need more RAM, and red as a sign it needs more. If pressure stays high during slowdowns, save your work and quit an unneeded app normally, then watch the graph again. Do not delete swap files or force a memory purge to improve a counter.

RAM checks versus free disk space

If your problem is a full startup disk, use the disk-space guide linked below. RAM counters describe working memory; removing files does not add physical RAM. Swap uses disk space, but its presence alone does not identify the cause of a slowdown.

If a command reports an error or prints no matching line, do not interpret that as zero memory. Read the error and use Activity Monitor as the fallback. The examples were checked on macOS 27.0.1; labels and available fields can vary by release. They do not require installing a cleaner or editing your shell profile.

Common questions

Is there a free command on Mac like on Linux?

No, macOS doesn't include free, but top -l 1 | grep PhysMem gives a similar one-line summary of used and unused RAM. Adding sysctl vm.swapusage covers swap, and vm_stat gives the detailed page-level breakdown that free doesn't have.

Why does my Mac show so little free memory in Terminal?

macOS keeps recently used files cached in spare RAM and hands it back when an app needs it, so a small unused figure alone does not establish a shortage. Apple's own guidance says having free or unused memory doesn't necessarily improve performance.

How do I check RAM pressure on Mac from Terminal?

Run memory_pressure without options for diagnostic counters, but do not treat its percentage as Linux available memory. In Activity Monitor, check the Memory Pressure graph while the slowdown happens. Green means efficient use; sustained yellow or red warrants reviewing the apps using memory.

How much RAM does my Mac have, checked from Terminal?

Run sysctl hw.memsize, which returns the installed RAM in bytes; dividing by 1,073,741,824 converts it to GiB (gibibytes). vm.swapusage separately reports swap total, used and free, noting that swap on a Mac is encrypted and grows or shrinks as needed rather than living in a fixed partition.

References & further reading

These guides combine the linked official guidance with ClearDisk’s documented behavior. Your files and app settings determine the right next step.

Main guide: why is my Mac so slow and how low storage affects speed · Browse all Performance & memory guides →

FROM A NUMBER TO AN ANSWER

See what’s using
your space.

Explore your Mac with ClearDisk’s free local scanner.
Review the files. Keep the control.

Download free scannermacOS 15+ · version 2.2.1Cleanup license: $10 once