Locking And Unlocking Files From Terminal

Ever needed to change finder’s lock bit on a file from the command line?  Well, it isn’t really a finder thing.  To wit:

# Lock a file
$ chflags uchg /my/favorite/file

# Unlock a file
$ chflags nouchg /my/favorite/file

I would say this is useful given that the OS likes to automatically lock inactive files, but that feature was apparently stripped from Mountain Lion.  Too bad, really; I actually kinda liked it (though I’m apparently the only one!).

S.

About Steve

When it comes to the desktop, Steve is a former Amiga, Windows, and Linux user, and as of six years ago, a die-hard Mac head (who, for once, isn't thinking of changing platforms again any time soon). When it comes to the server, Linux is pretty much the only game he plays. He also enjoys hardware hacking, and shouldn't be allowed near a keyboard after the sun sets (or for that matter, after it rises. Don't say I didn't warn you).
This entry was posted in Mac Hacking. Bookmark the permalink.