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.