/bin/sh: rm: command not found
Solution 1:
According to Apple's official documentation, it is by design that shell scripts invoked from AppleScript's do shell script
action do not inherit the $PATH
variable from your login shell's environment.
Accordingly, Apple instructs users to use full paths to commands when invoking shell scripts from AppleScript rather than relying on the $PATH variable in the environment.
In the script in your example, you could replace rm
with /bin/rm
According to the aforelinked documentation, this is the intended, documented behavior; a script that expects the environment's $PATH
to be set for do shell script
commands is a script with a bug.
That said, if you absolutely need to use relative paths and use $PATH to complete them, you could prefix any shell script called by do shell script
with the command PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin;
Solution 2:
hotfix = give the location of rm
command:
do shell script "/bin/rm -rf /Library/PreferencePanes/Growl.prefPane ~/Library/PreferencePanes/Growl.prefPane" with administrator privileges