An otherwise great app I'm using, annoys me as every time I start it, it writes to 2 files in the root of my user account which are clearly visible. Now, I have used the terminal command sudo chflags hidden with the name of the files to hide them, which does work, but nonetheless, when I launch the app again, it makes those once hidden files visible again!

The files content stays the same, so either its being re-written, or its being made visible again once the app is finished with them after boot, and whatever way it saves, the 'hidden' status of the files is being ignored or changed due to write permissions used by the app (I'm guessing).

Is there any way to ensure that this app can find these files and do whatever writes and saves it has to, but I can still keep them invisible in Finder? As in keep the files hidden to my view but readable and writable to the app? Is a combo chown / chmod command needed alongside a Finder preference setting?

  • 2
    I would report this as a bug to the app writer - perhaps naming and aiming it would help as well
    – mmmmmm
    Jun 8, 2014 at 20:48
  • I'd love to Mark, and I have thanks, but I'm not the only one to receive zero response about it. Vendor is a PIA I'm afraid. I think a system level workaround is the only viable path. That way if I can get it, I can at least inform all other affected users if they want a work around. But I do agree- the vendor should fix the issue!
    – VLostBoy
    Jun 8, 2014 at 21:37
  • Native Instruments Maschine 2 cough
    – VLostBoy
    Jul 19, 2014 at 10:35

2 Answers 2


Set an immutable flag on file(s) to prevent changes*:

sudo chflags hidden,uchg /path/to/file

What's an immutable flag?

"Immutable flags, also known as immutable bits, are file system attributes that, when enabled, prohibit changes to files or folders (objects), i.e. lock them. Enabled, immutable flags supersede permissions: you cannot modify an object whose immutable flags have been enabled despite having Read & Write permissions on that object."

Note*: This will ensure that the file remains hidden, but may prevent the application from running properly if RW access is needed. This is the tradeoff. That being said, to unset the flag, you would run:

sudo chflags nouchg /path/to/file

If this is the case, I advise that you contact the developer of the application since it need not automatically make a hidden file visible in order to be able to RW to that file. That's a bug in the application itself, period.

  • 1
    @njboot... that seems to have done it! I had deleted one of two files, then applied sudo chflags hidden,uchg to the other- the app crashed on launch, then created the second file- repeated the chflags command on this second file, then launched again.... and it was fine! Both files hidden, and all settings, preferences intact. Its early days, but it really does seem to have worked. I am working on the assumption that these files are created during 'first launch' only and are no longer written to during the apps lifetime. Fingers crossed- you've provided a way to back-track just in case- thanks
    – VLostBoy
    Jun 10, 2014 at 10:13

Try giving it 0 write access with:

sudo chmod 444 FILE_NAME

That will prevent the file from being written to. After you've done that, use the sudo chflags hidden command to hide them.

  • 2
    Wow- I didn't expect that NOT to work. I wrote a fake line in the file. I then chmod 444 to the file, then chflags hidden, and of course it hid. Then I launched the app- AND IT WROTE IT AGAIN- this time without the extra text I had saved in the previous version. Thanks Alex all the same. I wonder now if a cosmetic alteration to Finder would be the key... but no experience there either. Is there a Finder preference for specific hidden files I wonder??
    – VLostBoy
    Jun 8, 2014 at 22:07
  • Try setting the permissions, then locking it with chflags uchg, and see what that does... Jun 9, 2014 at 1:45
  • Thanks Gordon! In cases like this, I wish I could mark both of your answers correct. So far, so good, it works fine :)
    – VLostBoy
    Jun 10, 2014 at 13:11
  • Wow, I'm actually really surprised that didn't work. I've never seen chmod 444 be overridden. Ohh well, glad you found your solution though!
    – Alex
    Jun 10, 2014 at 21:39
  • From the command line both these commands affect the file despite the 444 permissions: sudo sed -i '' 's/rabbit/giraffe/' myfile and rm -f myfile. Similar system calls should also be able to do this. Jun 15, 2023 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .