Scripting permissions question

Hello All-

I’m trying to write a simple AppleScript application that will “do shell script” to move some files and change some permissions. Here is what I have done…


cp /beachballfolder/beachball /usr/local/bin

The problem is that when I run the Applescript I get a permission denied error. If I do this from the terminal with a sudo in front of the cp it works fine.

So is there some command I can place in front of the cp in the shell script to act like sudo? I tryed to just put sudo there and got a error. Rookie move I guess, but when your a greenhorn you will try anything.

Any ideas would help me out a lot!!


The permissions on the /usr/local/bin directory should allow you to cp directly to it without using sudo. Check the permissions on the /usr/local/bin directory, mine are…


Also, make sure you are using the filenames extension, if it has one, eg., beachball.txt

Actually, Greg, /usr/local/bin is owned by root, so only root can write to the directory, others can only read/execute.

As a result the script needs to be run ‘with administrator privileges’:

do shell script "cp /beachballfolder/beachball /usr/local/bin" with administrator privileges

You’ll be prompted for your sudo password, or you can avoid that by appending password “” to the do shell script command.

Andrew, my /usr/local/bin is owned by my user name…

%/usr/local/;ls -al

drwxr-xr-x 99 greg unknown 3366 Oct 14 22:47 bin/

I ran repairPermissions yesterday, and I don’t know why, or how, my group got set to “unknown”. I’ve never changed it myself, maybe some application installer did something???