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
.
ls -l $(which purge)
or trace the call with /usr/bin/dtruss to see where the error originates? – Hennes Nov 8 '13 at 14:40ls -l
on the purge binary will show if that bit is set. ( The $( ) starts a subshell and returns the value. In this case it is intended to locate the binary and then feed that output to the ls command. Akind towhich purge
-> purge is in /some/folder/purge and then doing als -l /some/folder/purge
. (all from the shell ofc) – Hennes Nov 8 '13 at 16:12