Quickly Hide a File in Mac OS X Using chflags
Want to quickly hide a file from prying eyes? Just like you can hide folders, you can hide individual files too. Here is how to do this using the command line tool chflags.
Launch Terminal from /Applications/Utilities/ and use the following command syntax:
chflags nohidden /path/to/hide/file.txt
If you know the path to the file just type it yourself. If you don’t, follow the drag & drop method to automatically type the entire path within the Terminal, just be sure to drop it in after the initial command, and then hit the return key:
chflags hidden [DRAG FILE HERE]
If you’re confused at all watch the quick video below that demonstrates the command being used with drag and drop:
Note these files will be hidden to everyone unless if hidden files are shown in the Finder.
At any point you can unhide the file with the following chflags command:
chflags nohidden /path/to/hide/file.txt
chflags should be familiar to anyone who has used it to show the Library folder in OS X Lion or Mountain Lion. This is trouble-free alternative approach to the setfiles method, which requires Xcode Developer Tools to be installed to use. You can also throw a period in front of a file or folder name to hide it from the Finder in OS X.
when i typed ‘ chflags hidden ‘ and drag folder to it, it appears as usage: chflags [-fhv] [R [H | -L | -P]] flags file …
How can i do ? plz help :(
Wow experience!! Worked!!
but make sure you remember the filename which you have make hidden.. or use “tab” button to reveal filename on terminal under /correct path/
If there is a way to hide a file, then there should also be a way to unhide it. How to do it in the terminal command? thanks in adv.
Oops! Updated the article to reflect unhiding, the command is:
chflags nohidden /path/to/hide/file.txt
It also works for encrypted disk images/sparse images/sparse bundles, adding a bit more security for sensitive financial etc., data.
Unfortunatelly, this does’t work for symbolic link !