Doing stuff on a Mac is supposed to be so easy and intuitive, that it’s surprising when something isn’t. There are several ways to “hide” stuff on a Mac, but only one of them really works well enough for us to recommend.
Easiest Way to Hide Files and Folders on a Mac :
It’s not even about hiding stuff so others can’t see it. Sometimes you may simply want to hide something because you want to declutter your system. For example, if you move your Windows documents to the cloud, you will notice that many applications will often use your Documents folder for saving. Games too will often create their own folders in Documents.
The problem is that soon your Documents folder can become cluttered with all these new folders. If you’re using Windows, you can easily hide stuff using folder preferences.
With OS X, it isn’t so easy (every operating system has a way to do it), and it might not be such an issue for a lot of users, but eventually there may come a time when you can’t delete a folder or file, but you also don’t want to see it.
Command Line, Take Them Away!
To hide stuff on OS X, the best method is to use the Terminal, which can be accessed by either double-clicking it from Applications, or using Spotlight, which is ideally suited for launching apps that aren’t pinned to your Dock.
With our Terminal open, we use a single command and some dragging-and-dropping to hide whatever we want out of view.
Here’s our Documents folder on OneDrive as seen in OS X’s Finder.
You remember that earlier Windows screenshot? All we needed to do to clean up this folder was to hide everything we didn’t want to see with a simple right-click.
OS X doesn’t have that capability, and we can’t move these things because it might mess stuff up on our Windows machines because it’s synced to the cloud.
Returning to our Terminal window, we type the command “chflags hidden ” just like it is in the quotes. Make sure you add the space to the end; it’s important for what we’re about to do. Go the to the location where you want to hide stuff, hold down the “Command” key and click to select all the files and folders you want to hide. Once you’re finished, simply drag them into the Terminal window.
The command prompt will paste all the locations you just dragged behind the chflags command. Here’s an example of what that might look like. All you do now is hit “Return” and everything will disappear.
This saves you a ton of time and typing because you don’t have to enter in each location and file by hand, and you also can hide a bunch of stuff at once.
The end result is a much nicer and cleaner Documents folder, similar to what we created in Windows File Explorer.
Undoing What You Just Did
Undoing all this isn’t quite as easy, because when you open your folder, the stuff you have hidden won’t show. Again, in File Explorer, it’s a great deal easier to show hidden items.
Nevertheless, open your OS X Terminal again, but this time navigate to the root folder where all your hidden stuff resides. In our example, it’s in our Documents folder, which is on our OneDrive.
We use the change directory (cd) command where, after “cd” you’d insert the path where you want to go. Again, you don’t have to type the path, you can simply drag the location over to Terminal. Just remember to add the space after “cd. ”
Once you’ve changed directories, type the “ls” command to list everything in the directory, and then use the “chflags nohidden” command. Stuff with spaces between words is denoted with a “\” such as “Microsoft\ Hardware” or “Custom\ Office\ Templates.”
If you’ve ever used the Terminal, then you might know you don’t have to retype commands over and over. You can actually recycle command by using the up and down arrow keys. This is really convenient if you have a command or commands you need to execute over and over, but don’t want to type and type and type.
So, there you have it, hiding and un-hiding folders and files in OS X. While it’s not exactly the most elegant method, it gets the job done.
Source : HTG