How do you hide a file or folder in Mac OS X?
In Windows it’s easy. Just right click a file or folder and put a check in the Hidden box.
In Windows 8 and 8.1, you can also select the item, pick the View tab in the Ribbon near the top of the File Explorer window and choose Hide selected items.
Easy breezy.
But right-clicking a folder in Mac OS X yields no such “Hidden” option.
In fact, if you make a new folder (Shift + Command + n), right click the folder and choose Get info (Command + i), you won’t see any option to Hide or Unhide.
Looks like Apple doesn’t like secrets.
This is such a basic task that I don’t know why it isn’t more prevalent.
Anyway, to hide a file or folder you need to visit the terminal.
Press Command + Space and type:
terminal
Now type this command in the terminal window but don’t press enter yet. We’re going to paste in the path to the file or folder by dropping the item directly into the terminal window.
chflags hidden
Note there’s a space after the word “hidden”
chflags lets you change the flags of a file or folder. By entering the hidden parameter we can hide the file from the GUI (from the Finder). Just keep in mind you (or someone) could easily access the item just by pressing Shift + Command + g and manually entering the path preceded by a tilde character (the tilde is an alias for your user folder).
For example, if you hid a folder named secret that was sitting on your desktop, you could display the contents by typing this in the Go to the folder: box
~/Desktop/secret
To unhide the folder, just type nohidden with the full path to the hidden folder
chflags nohidden ~/Desktop/secret
There you go.
On a side note, files and folders that start with a period (.) are hidden from the Finder. You can rename a file or folder from the terminal by typing:
mv oldfilename newfilename
So if I wanted to rename the secret folder to .secret I would type:
mv ~/Desktop/secret ~/Desktop/.secret
We basically just used the mv command (move) to move the folder into the same place and overwrote it with the new dot name.
Now it’s hidden
And that my friends is how to rename files and folders in Mac OS X.
Am I the only one who things this is nuts? Why can’t Apple just put a “Hide” button in Get Info? How difficult is it to code a “Hide” option that shows up when you Control click an item.