Deleting locked files

I have files i normally delete manually and Mac asks “Type your password to allow Finder to make changes”.

Is there any way to use AppleScript/CLI to trash/delete files which are owned by System and without user interactions. Thanks

Hello.

That would depend upon if you have administrative rights on your account or not.

if you have, then you can delete them with a do shell script, which you also can do with a do shell script with administrator privileges, but this is going to be as annoying if you haven’t fixed the sudoers file, to make the password to work for a while.

You’ll find some hacks around to make Finder operate with administrative rights, like dropping a copy onto the free app Pseudo and the like.

You should really be careful with files that are owned by System!

Thanks.

It is admin rights account.

How i do it using do shell script and how i can fix sudoers file?

The easiest is to do it from the commandline if you have an administrator account.

should do. if you have the files in a filelist, then you can do something like

I’d stay away from the sudoers file if I were you, but if you have to, google for sudoers, and grace period. it is not pleasant to make it work, really not pleasant.