What purge actually does
When you run sudo purge, macOS makes a kernel call that tells the virtual memory subsystem to discard the pages it has marked as inactive. Inactive pages are the cached remnants of files and data that were read into RAM at some point but are no longer actively in use by any running process.
macOS keeps this cache deliberately. If you open a file, close it, and then open it again, it is faster the second time because the data is still in RAM. The cache is a performance feature, not a bug. purge asks macOS to let go of that cache so other things can use the freed space.
Crucially, purge never touches active memory. Anything your running apps are actively using is completely off-limits. There is no risk of data loss, no risk of a crash, and no settings are changed. The purge man page describes it plainly: it forces disk cache to be purged. That is all it does.
The command requires sudo because flushing the kernel cache is a privileged operation. You are asking the OS to override its own caching decisions, which is why it demands your administrator password.
The 5-step procedure
The steps below work on every Apple Silicon Mac: M1, M2, M3, and M4.
Step 1: Install the Xcode Command Line Tools if needed
The purge binary ships with the Xcode Command Line Tools, not with the base macOS install. Open Terminal (Command-Space, type Terminal, press Return) and run:
xcode-select --install
A dialog asks you to install the tools. Click Install and wait. This is a one-time step and takes a few minutes. If the tools are already installed, the command tells you so immediately.
Step 2: Open Terminal
Press Command-Space to open Spotlight, type Terminal, and press Return. You just need the one window that appears.
Step 3: Run sudo purge
Type the command and press Return:
sudo purge
Terminal prompts for your Mac login password. Type it and press Return. You will not see any characters appear as you type: that is normal security behaviour. The command runs silently. No progress bar, no summary, no output. When the prompt reappears, it is finished. The whole thing takes about ten seconds on an M-series Mac.
Step 4: Verify with Activity Monitor
Open Activity Monitor (Command-Space, type Activity Monitor, press Return). Click the Memory tab. Look at the Cached Files figure in the bottom bar. On Apple Silicon you will typically see this number drop by a few hundred MB. The Memory Used figure may also dip slightly. Both are signs the command worked.
Step 5: Repeat as needed
You can run sudo purge as often as you like. macOS will rebuild its file cache over the next few minutes as you work, which is expected behaviour. The cache grows back because it is making your Mac faster. If memory pressure remains high after purging, the cause is active memory use by your open apps, and the solution requires a different approach.
What to expect on Apple Silicon
On Intel Macs from a few years ago, sudo purge could recover several gigabytes of RAM in one go. On Apple Silicon the numbers are more modest. In practice, running it on an M1 or M2 Mac with a typical workload will free somewhere between 200 MB and 800 MB. The exact figure varies by how long the Mac has been running and what apps have been used.
Two things explain the smaller effect. First, Apple Silicon uses a unified memory architecture, where CPU and GPU share the same physical pool. macOS is tuned specifically for this layout and releases inactive pages more aggressively on its own, leaving less idle cache to flush. Second, because the memory bandwidth on M-series chips is high, macOS can afford to be more conservative about what it keeps cached, so there is simply less low-value data sitting around waiting to be evicted.
The result is that sudo purge does something real on Apple Silicon, but it is not dramatic. If you run it and Activity Monitor barely moves, that is not a failure of the command. It means macOS had already done most of the work.
For a deeper look at why the command behaves differently by chip generation, see does sudo purge work on Apple Silicon.
When purge is the right tool
There are a handful of situations where running sudo purge makes practical sense, even accounting for the modest effect on Apple Silicon.
After a long browser session. A browser with dozens of tabs open over several hours leaves a lot of cached page data sitting in RAM. Closing the tabs helps, but running purge afterwards clears whatever residue is left in the file cache. Combined with closing the tabs, you often recover more than either step alone.
Before your Mac goes to sleep for a long stretch. If you are stepping away for a few hours and want to come back to a clean state, running purge before the lid goes down is harmless and occasionally speeds up the wake.
Before starting a memory-intensive build or render. Compiling a large Xcode project, rendering a video, or running a machine-learning job all benefit from having clean headroom. Running purge immediately before you kick off the job clears cached files that the build process will not need, giving it a slightly cleaner start.
When you want to confirm how much free memory you actually have. Because macOS aggressively caches files, the "used" memory figure in Activity Monitor is often larger than what your apps actually need. Running purge and then checking Activity Monitor gives you a clearer picture of true active memory usage.
sudo purge is honest, harmless, and quietly useful. Just temper your expectations.When to use something else
There are situations where purge is the wrong tool and reaching for something else will give you better results.
When an app is the memory hog. If one specific process is holding several gigabytes of active memory, purge cannot touch it. Open Activity Monitor, click the Memory tab, sort by the Memory column, and force-quit whatever is at the top. That is a much more effective intervention. Our guide to clearing memory on Mac without restarting covers this in detail.
When memory pressure is red and staying red. The Memory Pressure graph in Activity Monitor turns red when macOS is genuinely struggling to satisfy active memory requests. At that point, the problem is not cached files: it is that your running apps need more RAM than you have. Flushing the cache may give a brief reprieve, but the pressure will return. Force-quitting apps or restarting is the real fix.
When you want an automatic solution. Running a Terminal command every time things feel slow is a reasonable habit, but it requires you to notice the problem, open Terminal, type the command, and enter your password. A menu-bar memory utility handles this without the interruption. For more on that class of tool, see how to free up RAM on Mac.
When the Mac has been running for two weeks. Some background processes develop slow memory leaks over time. purge cannot fix a leaked allocation because leaked memory is still technically active from the kernel's perspective. A restart is the only clean solution in that case.
If you want one click instead of one Terminal command, Shiny does the same job from the menu bar. It watches memory pressure, flushes inactive memory when things get tight, and closes orphaned helper processes that persist after their parent app has quit. The same outcome, without opening Terminal.