Mac OS X and Mac OS X Server come with several GUI tools to make configuring your Mac easier. Many of these tools make changes to the configuration files of the various daemons on your system. However, these tools can often become confused when you make your own changes to the files by hand. They might overwrite your changes or fail to load in your custom settings.
While there's not much one can do to get such a tool to recognize your settings, there is a utility which can keep them from being overwritten. This utility is called
chflags and it lives in the
/usr/bin folder. The
chflags tool both locks and unlocks a file for changes. Once a file is locked, it cannot be modified at all. Not by another utility and not by a user.
To lock a file, issue the command
chflags uchg filename. If you are modifying a system file, you will need to have administrator access [See Mac OS X Hack #50] to use chflags. Now that the file is locked, try using touch or an editor to modify the file. You'll get a permission denied error.
Now, to unlock the file, use the command
chflags nouchg filename. You should now be able to modify the file once again. Just remember to lock it back up again, or you might get your changes overwritten.