3

In Mountain Lion, I frequently used a simple automator app called "Purge Memory" which just ran "purge" in the command line. I really enjoyed cleaning the RAM, especially when buggy apps ran memory leaks.

But now in Mavericks purge requires root privileges, breaking my app. I know I can open terminal and input it, but that is not nearly as convenient.

I have heard that on Unix you can allow a specific command to always run as root. That way I could automate purge. I would like to know if anyone knows how to do this or if this would even solve the problem?

  • 5
    No. No no no no no. Running 'purge' to clear the inactive memory is bad. Very bad. Read here: apple.stackexchange.com/questions/67031/… – Richard J. Ross III Oct 23 '13 at 9:50
  • When I open terminal and input "Purge"; the system replies: "Unable to purge disk buffers: Operation not permitted"; did this happen to you? – user60199 Oct 23 '13 at 16:14
  • Yes, you must run "sudo purge" in Mavericks. – JeffM Oct 23 '13 at 17:54
  • 3
    As far as I'm concerned, running purge is a cargo cult. It's needed for the appearances only, it has no real benefits. You need it when you don't understand how the virtual memory system works on OS X. I have been running OS X since getting an iMac that had Leopard on it in Dec 2007. I've since been running various versions, and not once had I run purge. And I'm a heavy user, with three machines, and multiple virtual machines and lots of sometimes runaway code under development. The only thing purge is guaranteed to do is slow things down. – Kuba Ober Oct 23 '13 at 17:58
  • 2
    @KubaOber: OS X (at least through 10.8) seems to handle inactive memory very poorly -- in theory, it speeds up operation, but in in my experience once you run out of free memory, it will start paging (rather than intelligently dropping inactive memory), and performance will fall off a cliff. purge does actually help with this. However, 10.9 has changed memory handling considerably, and until people have more experience with how it works, assuming purge will have the same effect it used to is unwarranted (although user60372's answer suggests it does still have the same problem). – Gordon Davisson Oct 24 '13 at 17:39
6

You could use a Run AppleScript action that runs do shell script "purge" with administrator privileges. It requires entering a password though.

If you don't want to enter a password, add %localaccounts ALL=NOPASSWD: /usr/sbin/purge to sudoers. (Run sudo visudo, press i, type or paste the text, press escape, and type :wq.) Then use a Run Shell Script action that runs sudo purge.

3

I disagree about purging unused RAM being useless. I have 8GB of RAM, and when free RAM gets down to a several MBs, my Mac gets very sluggish, and it's even hard to switch Finder windows without it being really slow. The purge command fixes that right up.

Now Mavericks uses compressed memory, so you aren't supposed to need such things, but I still find that my Mac gets unresponsive when there is not enough free RAM. Typing "sudo purge" into terminal freed up 2GB of RAM, and things are nice and snappy again.

  • Welcome to Ask Different! This is all helpful information, but doesn't actually answer the question regarding using Automator to invoke a purge. When you have 50 reputation, you can comment anywhere, and you should put information such as this in a comment. – grg Jan 3 '14 at 21:33

You must log in to answer this question.

protected by Community Oct 25 '13 at 23:31

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged .