How to Use the footprint Command in macOS Terminal to Diagnose True Process Memory Usage

Monitoring application resource consumption in macOS through Activity Monitor provides high-level metrics like Real Memory, Compressed Memory, and Virtual Memory. However, these figures can be misleading for developers, power users, and system administrators trying to track memory leaks or diagnose background bloat. Apple includes a low-level command-line utility called footprint directly within macOS. This diagnostic tool inspects the Mach virtual memory subsystem to calculate the actual memory footprint of any active process, distinguishing between shared memory, purgeable caches, compressed pages, and dirty memory that cannot be paged out.

Understanding Memory Footprint vs Virtual Memory in macOS

Modern operating systems use complex virtual memory paging. A process might map gigabytes of frameworks, libraries, or disk-backed files into its address space without actually consuming physical RAM. In macOS terminology, memory is categorised into specific states:

  • Dirty Memory: Memory that has been written to and altered by the process. It must remain in physical RAM or compressed memory; it cannot simply be discarded from disk.
  • Clean Memory: Read-only memory mapped from disk (such as shared frameworks or executable code). If physical memory runs low, the kernel can safely purge it and reload it later.
  • Compressed Memory: Inactive dirty memory that the macOS kernel compresses dynamically to avoid disk paging.
  • Purgeable / Reclaimable Memory: Image caches and temporary assets that the application marks as discardable under memory pressure.

The footprint utility calculates the true footprint by adding Dirty Memory and Compressed Memory while excluding clean, purgeable, and kernel-shared mappings.

Running the footprint Command for Single Processes

To inspect a running application or process, open Terminal (located in /Applications/Utilities/). Because footprint queries kernel task ports, root administrative privileges (via sudo) are required to inspect processes belonging to other users or system daemons.

Auditing by Process Name

You can target an application directly by its bundle name or process executable:

sudo footprint Safari

This generates a concise breakdown summarizing the dirty, clean, and compressed pages allocated across all memory regions used by the primary Safari process.

Auditing by Process ID (PID)

When multiple instances of a tool or helper service exist (such as multiple render processes for web browsers), inspect the exact PID:

  1. Locate the target process ID using pgrep:
    pgrep -f "WindowServer"
  2. Run footprint against that PID:
    sudo footprint 312

Analysing System-Wide Memory Consumption with footprint

To capture an instantaneous breakdown of every active process sorted by true footprint on your Mac, use the -a (all processes) flag combined with formatting switches:

sudo footprint -a

This scans all active Mach tasks and produces a ranked list detailing which applications are responsible for memory pressure on the unified memory architecture of Apple silicon or Intel Macs.

Key footprint Command Arguments and Options

The table below summarizes the most useful options and flags available when executing footprint in macOS:

Option / Flag Syntax Example Purpose & Output Details
-a sudo footprint -a Gathers and prints memory footprint data for all active processes on the system.
-v sudo footprint -v <PID> Enables verbose output detailing every individual virtual memory tag and allocation zone.
-j <path> sudo footprint -j output.json Safari Exports the full memory diagnostic tree into a structured JSON file for parsing or scripting.
-s sudo footprint -s <PID> Shows per-thread stack allocations alongside heap memory statistics.
-d sudo footprint -d <PID> Displays detailed breakdown of dirty memory categorization across mapped segments.

Interpreting Output Categories and Identifying Leaks

When reviewing the standard summary produced by footprint, focus on these critical fields:

  1. Total Footprint: The definitive metric showing how much physical RAM (including kernel-compressed blocks) is occupied strictly by this process.
  2. Dirty Heap Allocations (malloc): Indicates dynamic memory allocated by standard libraries. If this number steadily climbs over time during prolonged application runtime without returning to baseline, the application likely has a memory leak.
  3. IOKit / Metal Allocations: Highlights memory allocated for GPU textures, render pipelines, and display surfaces. Unusually large allocations here point to graphic cache leaks.
  4. VM Tags: macOS categorises memory allocations with Mach tags (such as VM_MEMORY_JAVASCRIPT_JIT or VM_MEMORY_SQLITE). These tags pinpoint the exact subsystem responsible for memory consumption.

Automating Memory Audits with Shell Scripts

You can integrate footprint into automated monitoring scripts to alert you when a background service exceeds a predefined footprint threshold. The following command filters JSON output to extract the exact footprint bytes of a target daemon:

sudo footprint -j /tmp/audit.json com.apple.WebKit.WebContent && jq '.processes[0].footprint' /tmp/audit.json

This allows automated profiling during continuous integration pipelines or long-running diagnostic sessions on macOS workstations.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.