macOS is highly efficient at managing system memory. When you close a large application, the operating system intentionally leaves much of the data cached in “inactive” RAM. This ensures that if you reopen the app, it launches instantly. However, if you are transitioning between massive creative workflows—such as closing Final Cut Pro and immediately opening Logic Pro—this cached memory can cause temporary system stuttering as macOS scrambles to reallocate space. Rather than restarting your computer, you can force the system to instantly dump all inactive memory using the Terminal purge command.
What the purge Command Actually Does
The purge command forces macOS to flush the disk cache and clear all inactive memory, simulating the exact memory state of a computer that has just been freshly rebooted. It does not close your active applications or delete any saved data. It simply evicts the dormant files that macOS was holding onto “just in case” you needed them again, freeing up gigabytes of physical RAM for your next heavy task.
What You Need Before Starting
Because flushing the system memory cache affects the core operation of the macOS kernel, this command requires administrative privileges. You will need the administrator password for your Mac to execute the command successfully.
Executing the Purge Command
The process takes only a few seconds to run.
- Open the Terminal application on your Mac (located in Applications > Utilities, or searchable via Spotlight).
- Type the following command into the Terminal window:
sudo purge
- Press Enter.
- The Terminal will prompt you for your password because of the
sudoprefix. Type your Mac’s login password. Note: As you type, no characters or asterisks will appear on the screen. This is a standard security feature in Unix. Just type the password and press Enter.
The Terminal prompt will pause for a brief moment—usually between one and three seconds—while the memory is flushed. Once the standard command prompt reappears, the process is complete.
Verifying the Results
If you want to see the immediate impact of the command, you can use the macOS Activity Monitor.
- Open Activity Monitor (Applications > Utilities).
- Click on the Memory tab at the top of the window.
- Look at the “Memory Used” and “Cached Files” statistics at the bottom of the window.
- Leave the window open and run the
sudo purgecommand in the Terminal again.
You will see the “Cached Files” metric drop dramatically, often by several gigabytes, immediately increasing the amount of free physical memory available to your active applications.
When Should You Use This Command?
The purge command is a powerful troubleshooting tool, but it should not be used obsessively. Modern macOS memory management is excellent, and running this command every hour will actually slow down your Mac, as the system will have to constantly read data from the much slower SSD instead of the ultra-fast RAM. Reserve the purge command specifically for moments when your Mac feels noticeably sluggish after closing heavy applications, or right before initiating a massive render or compile job where you need every megabyte of RAM available.