24

When I try the purge command on my terminal, OS X Mavericks gives me the following message:

Unable to purge disk buffers: Operation not permitted

This hasn't been the default behavior until now. I wonder why Apple changed that. Is there a reason behind this decision? What are the advantages/disadvantages of this?

5 Answers 5

24

You need to run this command with root privileges. Try:

> sudo purge

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:

Enter your account's password and it should run the purge command.

Apple probably made the decision for security purposes. The only disadvantage is you have to type in your admin password. The advantage is, for non-admin users, they can not run this command and potentially harm their OS.

Usually commands that require sudo in order to run at all are potentially destructive or invasive. Two other commands with this requirement are dtrace and xcode-select.

3
  • 3
    I was concerned about apps that presumably "speed things up" using purge. This answer helped me to understand why it's not a good idea.
    – Gabe
    Oct 24, 2013 at 21:50
  • 1
    I can not close a question as a duplicate across SE sites, so I blatantly copied your answer here. Feel free to post your own copy so I can delete my copy of your answer.
    – Hennes
    Nov 8, 2013 at 16:51
  • Can you elaborate on "Apple probably made the decision for security purposes"? What kind of security issues do you believe the command purge creates? Jul 7, 2016 at 8:10
1

Using the purge command can have serious negative effects on the performance of the system (since you are essentially telling the kernel to forget all of its accumulated knowledge about your recent usage, walk through the inactive list and toss everything -- even if some process/driver was about to make use of it -- and then fault/recreate it all again from scratch). Thus, it makes sense that it would require some level of privilege to execute it.

1

I'm no expert, but it may have something to do with the compressed memory thingy in OS X 10.9

Doing more

The more memory your Mac has at its disposal, the faster it works. But when you have multiple apps running, your Mac uses more memory. With OS X Mavericks, Compressed Memory allows your Mac to free up memory space when you need it most. As your Mac approaches maximum memory capacity, OS X automatically compresses data from inactive apps, making more memory available

Exrta Fast

Once the memory is compressed, your Mac doesn’t have to waste time continually transferring data back and forth between memory and storage. So it’s able to get more done in less time. And since compressing and decompressing happens almost instantly, the only thing you’ll notice is how responsive everything feels. Especially when you’re doing everything at once.

Source: http://www.apple.com/osx/advanced-technologies/ (non-existing)

See also: OS X Mavericks is more than Powerful: It’s Power Smart (PDF)

They may have done that do avoid the older program from interfeering with the new way of doing things. But I have no idea.

-1

'purge' does not release enough RAM. I am using SystemPal: https://itunes.apple.com/app/systempal/id453164367?mt=12 It works very well!

2
  • 2
    What differences in behaviour make you believe a third party app from the Mac App Store can purge more memory than an OS X included tool from Apple? May 28, 2014 at 8:34
  • 1
    Or that any app/casual-user could make better decisions about memory management than the kernel?
    – jhfrontz
    Jul 14, 2014 at 23:07
-5

http://computers.tutsplus.com/tutorials/how-to-give-your-mac-a-performance-boost--mac-46271

Creating a Terminal Script to Purge the Memory

  1. Start by opening Terminal.

  2. Enter the following line:

    cd Desktop/
    

    and press enter. This points the Terminal to your desktop rather than your user folder. You can point Terminal to any folder you want for this tutorial.

  3. Enter:

    touch Purge
    

    and press enter. This creates a new file called "Purge" on your desktop, you won't see it just yet though.

  4. Enter:

    pico Purge
    

    and press enter. This opens up the Terminal editor for the purge file.

  5. Enter the following text in the editor:

    #!/bin/sh
    
    purge
    
  6. Press Control + O and then Enter to save the file to your desktop. Then press Control + X to exit the editor. Make sure to use the Control key, not the command key.

  7. Once you're back at the normal Terminal screen, enter:

    chmod 755 Purge
    

    and press enter. This makes the file we just created accessible to you. By default, OS X hides the files you create using touch.

  8. You now will have a file on your desktop called "Purge." You can open this file to automatically clean your computers memory. Once the Terminal shows a [Process complete] message you can close the application and continue on.

2
  • This does not solve the problem described in the question. Also, please fix the formatting of your post.
    – nohillside
    Mar 31, 2016 at 8:36
  • 1
    Always source copied content (cc @patrix).
    – grg
    Mar 31, 2016 at 11:01

You must log in to answer this question.

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