Purge command not authorized
Answer blatantly copied from our sister site:
You need to run this command with root privileges. You can do that in several ways:
1) Elevate one command to uid 0 rights with the sudo
command:
> 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.
If you do not want to enter a password, add %localaccounts ALL=NOPASSWD: /usr/sbin/purge
to sudoers. (From a shell 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.
2) Log in as root and issue the command.
Optionally after enabling the root account
3) From your terminal prompt (a bash shell) type su -
, the root password and then /usr/sbin/purge
.
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
.
Related videos on Youtube
![Vedant Chandra](https://i.stack.imgur.com/XJGhK.png?s=256&g=1)
Vedant Chandra
Undergraduate student at Johns Hopkins University, studying Physics and Applied Mathematics.
Updated on September 18, 2022Comments
-
Vedant Chandra almost 2 years
I used to use the
purge
command in Terminal to flush my buffers on my Macbook Pro (mid-2012). Then, I upgraded to OSX Mavericks, and when I triedpurge
again, I got this output:Unable to purge disk buffers: Operation not permitted
I have tried everything to authenticate it, I even used
sudo
before it, but nothing has worked so far. What is the cause for this and how can I fix it?-
ganesh over 10 yearsSanity check: Are you aware that using purge does not speed up your computer? (In fact it probably slows it down). Free memory is unused memory which might as well be in a desk drawer then inside the computer. Memory assigned to buffers is useful (and gains you speed) and if more free memory is needed than is available then the OS will free (purge) these buffers on its own.
-
Vedant Chandra over 10 yearsYes I am aware of that, I use purge to free up the buffers before starting a heavy game.
-
ganesh over 10 yearsI do not have a Mac (and thus no OS X) to test things on, but Operation not permitted sounds like insufficient rights to do so. Can you add the output of
ls -l $(which purge)
or trace the call with /usr/bin/dtruss to see where the error originates? -
Vedant Chandra over 10 yearsCould you please clarify?
-