Preventing files from being changed I hate programs like Flash and others that install crappy settings on /Library/LaunchDaemons and /Library/LaunchAgents, stuff to launch daemons that check for updates of flash.

I generally replace the files these apps put there with empty files and change permissions to 000 using chmod. 

This works fine but every time I have to install an update, the update installation removes the locked files with their crappy files again.

Is there a way to lock these files in a way that any installation can change?

thanks
You can do it using chflags. Try this way:

chflags uchg filename


Once type this command, filename can only be modified by you. Others users (root included) can't change it.

To revert the changes, use:

chflags nouchg filename


See the example below:

✔ jherran@computer: ~/temp $ touch filename
✔ jherran@computer: ~/temp $ chflags uchg filename
✔ jherran@computer: ~/temp $ sudo su
Password:
✔ root@computer: /Users/jherran/temp # rm filename
rm: cannot remove ‘filename’: Operation not permitted
✘-1 root@computer: /Users/jherran/temp # rm -f filename
rm: cannot remove ‘filename’: Operation not permitted
✘-1 root@computer: /Users/jherran/temp #