How to Speed Up Your Mac Using the Purge Command

There are a number of things that happen when you just double-click on an app and launch it. The contents of the app are loaded into your RAM and disk caches so that the most important parts of the app can be fed quickly to the CPU. In the end, when you quit an app all of its cache files and RAM contents are removed so other apps can occupy that space.

However, that does not always happen. Sometimes the apps leave their content at these places on your machine, meaning other apps do not get full usage of these resources. And that is exactly when you feel your Mac has slowed down. At such times you will hear advice from other people to turn off your Mac and turn it back on again. When you do that your Mac clears the content of the cache and RAM and allows for any apps to fully use those resources.

You also have a manual way to clear the contents of RAM and disk caches, and it uses a command called purge in Terminal. When the command is executed, the contents on your RAM and disk caches are removed so that the apps you launch thereafter can use these resources.

Here’s how it works.

Speeding Up a Mac Using the Purge Command

1. Quit all of the running apps on your Mac. If you have to do this often, you might want to create an Automator service that does it for you in a single-click.

2. Launch Terminal on your Mac.

3. When Terminal launches, type in the following command and press Enter. The command should clean up both RAM and disk caches on your Mac.

sudo purge

purge-sudopurge

4. Since it uses sudo, you will be asked to enter your admin password. Do so and press Enter.

purge-password

5. When the command has done its job, it will revert back to the normal Terminal window. You will not get a confirmation or anything to indicate the job is done.

All the contents on the RAM and disk caches should now be removed, and that space is now available for others apps to use.

If you think this helped you speed up your Mac and you would like to do it again and again, then a convenient idea would be to create an Automator service that runs this command instead of you going ahead and launching Terminal and typing in the command to execute it every time.

Here’s how to create an Automator service for the command.

Creating an Automator Service for the Purge Command

1. Launch Automator on your Mac.

2. When Automator launches, select the “Applications” folder in the left panel and then click on “New Document” to create a new service.

purge-new

3. On the screen that follows choose “Service” as the document type and then click on “Choose” to begin creating your service.

purge-service

4. Drag the action named “Run AppleScript” from the Actions pane on the left and drop it onto the workflow on the right.

purge-applescript

5. Type in the following script into the AppleScript box in your workflow.

tell current application
activate
do shell script “sudo purge” with administrator privileges
end tell

purge-script

6. Save the service by clicking on the “File” menu on the top and selecting “Save…”

purge-save

7. You will be asked to enter a name for the service. It could be anything of your choice. I have entered “Sudo Purge” as it explains the command.

Then click on “Save” to save the service.

purge-name

8. You can now run the service from whatever app you are in. Just click on the app name on the top and select “Services” and then choose “Sudo Purge.”

purge-run

9. If you want you can make an Application instead of a service and place it in your Dock. To do that, simply choose “Application” in step three and then follow the rest of the steps.

Conclusion

If you think your Mac has slowed down, then your RAM contents and caches are probably full of content. The guide above should help you remove them to help you speed up your machine.

Image Credit: Wikipedia

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Mahesh Makvana

Mahesh Makvana is a freelance tech writer who's written thousands of posts about various tech topics on various sites. He specializes in writing about Windows, Mac, iOS, and Android tech posts. He's been into the field for last eight years and hasn't spent a single day without tinkering around his devices.