Why does OS X Mavericks block the purge command in Terminal?

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?


Solution 1:

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.

Solution 2:

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.

Solution 3:

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.