When your Mac is slowing down, try this Terminal tip

This is one of the most useful Terminal tips you’ll ever come across. It’s the go-to fist stop solution if apps like Safari start to hang, Mail starts to freeze, or applications otherwise become less responsive than normal.

What is the problem?

Macs just run and run. That’s great, and that’s why so many Mac users rarely switch their computers off. That’s fine too, as these systems can handle that, but after you’ve been using them for an indeterminatewhile you may find that they become less responsive. Usually this is because one or more of your apps has taken RAM from your system in order to run, but failed to release it back when it ceased to be the active app. The end result? After some time your Mac won’t have the memory it needs to run things efficiently.

Here’s what to do

You can restart your Mac to flush your system’s RAM if you like, though you’ll need to quit and restart all your applications which will use precious time. Or try this Terminal tip:

  • Launch Terminal (Command-Spaceand type ‘Terminal’, hit Return)
  • In the Terminal window, type ‘sudo purge’ (without the quotation marks) and hit Return. (On versions of OS X prior to Sierra just type ‘purge’.) WARNING: Do not mistype this as very bad things can and will happen
  • You’ll be asked to enter your password (it won’t show as you do, so type carefully), hit Return.

You won’t see anything happen, but if any of your apps are using memory they don’t need to be using it will be returned to the central pool.

This should have the same effect as restarting your Mac – with the advantage of not needing to relaunch your applications. And everything should then run a little more smoothly.

NB: This is particularly useful when working with older Macs.

Jonny Evans

Watching Apple since 1999. I don't say what they should do. I say what they might do. They sometimes do.

1 Response

  1. Cache says:

    This actually doesn’t clear memory but disk cache. From the purge man page:

    purge(8) BSD System Manager’s Manual purge(8)

    purge — force disk cache to be purged (flushed and emptied)


    Purge can be used to approximate initial boot conditions with a cold disk buffer cache for performance analysis. It does not affect anonymous memory that has been allocated through malloc, vm_allocate, etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.