Purge Command on Mac: Free Inactive Memory
Yes, the purge command in macOS can free up inactive memory by forcing the system to discard cached files and data that are no longer actively in use. You run it in Terminal, and it immediately clears the memory pressure that often shows up as a red or yellow graph in Activity Monitor. This article explains exactly what purge does, when it helps, and when it is better to leave your Mac alone.
What Is Inactive Memory on a Mac?
macOS uses a memory management system that keeps recently used files and app data in RAM even after you close the app. This is called inactive memory. The idea is that if you reopen that app or file, it loads instantly because the data is still in RAM. The system also uses free RAM to cache disk reads, so opening a large file the second time is much faster.
In Activity Monitor, the Memory tab shows a graph at the bottom with four colors: green (free), blue (wired), yellow (active), and red (inactive). A large red section means the system is holding onto a lot of data that is not currently being used. This is not a problem by itself—macOS will automatically purge inactive memory when a new app needs RAM. But some users prefer to force that purge manually, especially if they see memory pressure in the red and want to see the numbers drop immediately.
What the purge Command Actually Does
The purge command is a built-in Unix utility that has been part of macOS for many years. When you run it, it tells the kernel to discard all inactive pages from memory. That includes cached files, previously used app data, and other non-essential data that is not actively wired into a running process.
It does not kill any running apps or processes. It only clears the cache and inactive pages. After running purge, your Mac may feel slower for a few seconds because apps that relied on that cache will need to read from disk again. But no data is lost—the files are still on your hard drive or SSD; they just are no longer in RAM.
You need to run it with sudo because it directly interacts with the kernel’s memory subsystem. The command is:
sudo purge
You will be prompted for your administrator password. After you type it, the command runs and returns to the prompt. There is no output on success.
How to Run purge in Terminal
Here are the exact steps to run the command safely:
- Open Terminal (Finder → Applications → Utilities → Terminal, or search for it in Spotlight).
- Type
sudo purgeand press Return. - Enter your admin password when asked. The cursor will not move while you type the password—that is normal.
- Wait for the command to finish. It usually takes less than a second, but on a heavily loaded system it may take a few seconds.
- Check Activity Monitor to see the memory pressure graph drop.
If you want to see the effect, open Activity Monitor before and after running the command. You will see the “App Memory” and “Cached Files” numbers change. The “Memory Used” total may drop, but the “Swap Used” may stay the same because purge does not remove swap files.
When Should You Use purge?
There are a few situations where running purge genuinely helps:
- Before a large memory-intensive task – If you are about to edit a huge video or compile a large project, freeing up inactive memory can give you a bit more headroom.
- After closing a memory-hogging app – If you closed a browser with 50 tabs and the memory pressure stays high, a purge can release that cached data.
- When Activity Monitor shows red pressure for a long time – If your Mac is swapping heavily and you want to force a cleanup without restarting.
However, for most everyday use, you do not need to run purge at all. macOS is designed to manage memory automatically. Running it too often can actually slow your Mac down because it removes useful cache that would speed up app launches and file access.
Common Misconceptions and Problems
A frequent misconception is that purge will “fix” a slow Mac or reduce swap usage. It does not. Swap files are stored on disk and are managed by the kernel separately from inactive memory. If your Mac is swapping, that means it is truly short on RAM, and purging inactive memory will not help—the system will just re-cache the same data later.
Another issue is that some users run purge and see no visible change. That is because the memory pressure graph may already be green, or because the system immediately re-caches the most frequently used data. The command only clears what is truly inactive; it does not force active apps to release memory.
There is also a myth that purge can damage your Mac. It cannot. It is a standard Unix utility that has been part of macOS for over a decade. It does not touch system files or user data. The worst that can happen is a temporary slowdown as caches rebuild.
Alternatives to purge
If you want to free up memory without using the command line, you have several options:
- Restart your Mac – This clears all memory, including inactive and wired, and resets swap files. It is the most effective but also the most disruptive.
- Quit unused apps – Simply closing apps that you are not using frees their active memory, which is often more useful than purging cache.
- Use Activity Monitor to identify memory hogs – Sort by memory and quit the biggest consumers.
- Reduce cache usage – In browsers, clear cache or limit the number of open tabs. Some apps have settings to reduce memory usage.
For most users, the best approach is to let macOS handle memory management. The system is very good at deciding what to keep in cache and what to discard. Manually purging is only useful in specific situations, like before a known memory-heavy task or when you want to see the memory pressure graph drop for peace of mind.
Frequently Asked Questions
Is purge safe to run?
Yes, purge is completely safe. It only clears inactive memory pages and cached data. It does not affect running apps or your files. You can run it as often as you like, though it is not necessary on a regular basis.
Will purge speed up my Mac?
In most cases, no. The macOS memory manager already frees inactive memory when needed. Forcing a purge can actually make things slower temporarily because apps have to reload data from disk. It only helps if you are about to start a memory-intensive task and want to maximize available RAM.
Why does Activity Monitor still show high memory after purge?
Because purge only clears inactive memory. If your Mac is using a lot of active memory (apps you have open), that will not change. Also, the system may quickly re-cache files that are frequently used, so the memory pressure graph may return to normal levels within seconds.
Does purge clear swap files?
No. Swap files are separate and are managed by the kernel. purge does not touch them. If you want to clear swap, you need to restart your Mac.
Can I run purge without sudo?
No, you need administrator privileges because the command directly interacts with the kernel’s memory subsystem. Without sudo, you will get a “Operation not permitted” error.
What is the difference between purge and clearing cache in an app?
Clearing cache in an app (like a browser) deletes files from disk. purge only removes data from RAM. They are completely different operations. purge does not delete any files from your disk.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.