Stop files being automatically (re)created by apps

18 July 2015, 12:41

Sometimes you might delete a config file or maybe an entry in /Library/LaunchAgents (or ~/Library/LaunchAgents), only to find it’s been recreated next time the app concerned runs.

It can be very frustrating, especially with apps from companies like Google and Adobe that like to run update processes in the background without your knowledge — or permission.

One solution is to simply rename the existing file with an .old extension, but before doing so copy all the text in the filename. Then create a new folder in that location, and paste in what you copied for its name. You might see a warning about file extensions but that’s OK — just go with it. Then select the new folder, tap Cmd+I, and choose to lock the folder in the Info dialog box.

This essentially blocks recreation of the file because when the app tries it’ll see that there’s already something there with that filename AND it’s locked, so can’t be modified.

Another way to do this if you’re a fan of the command line would be to simply use the touch command to create the dummy file, but at least with a folder you can see at a later date what you’ve done, whereas a touched file looks and smells legitimate — and could be confusing.

I’ve read another way to stop this happening is to lock the folder entirely — you could just lock /Library/LaunchAgents, for example. But this sounds like a shortcut to trouble.

Know better?