How to Hide Files, Folders and Desktop Icons on Mac

Install Macos Virtualbox Featured

Do you often have to do a presentation on your Mac and don’t want others to see what’s on your desktop or in your Finder? It could be that your desktop is so overwhelmed with files and folders that it becomes unsightly, or there may be confidential stuff that is not suitable for the public. Whatever the reason, you are probably looking for a way to quickly hide files, folders and desktop icons on your Mac.

Here we show you how to hide files, folders and icons on your Mac desktop and Finder.

1. Using Terminal to Hide Desktop Icons

Open the Terminal app from the Launchpad.

Type in the following command and press Enter. This will hide everything on your desktop.

defaults write CreateDesktop false
killall Finder

Your desktop should be blank, without even a single icon on your desktop.

Unhiding the Icons on the Desktop

If you are done with your work and you wish to unhide the icons, here’s how to do that.

Launch Terminal on your machine, type in the following command and press Enter. All your files and folders will now reappear on the desktop.

defaults write CreateDesktop true
killall Finder

2. Using Finder to Hide Device Icons

Make sure you are inside a Finder window. If you are on your desktop, you are already there.

1. Click on the “Finder” menu on the top and select “Preferences … “


2. When the panel opens, make sure you are in the General tab.

Under the “Show these items on the desktop” section, you will find the items that are visible on your Mac’s desktop. Uncheck all of them so that they are no longer a part of your desktop.


3. As soon as the items are unchecked, they will be removed from your desktop, helping you keep your desktop uncluttered.


If you want to make some files or folders disappear, there are several methods to hide files and folders on your Mac. This won’t encrypt the files, but it will make them invisible while browsing in Finder.

3. Hide Files with System Commands

macOS offers a couple ways that allow experienced users to employ system functionality to hide files. They all involve Terminal in varying capacities. There are also apps that will execute these commands behind a graphical interface if you’re not confident with the command line.

Set the Hidden Flag in Terminal

1. Open Terminal.

2. Type in the following commands, but don’t press the Enter key just yet:

chflags hidden

3. Drag the file or folder you want to hide into the Terminal window.


4. Once the path appears in the Terminal window, press Enter to set the hidden flag.

Remove the hidden flag with the same process, but change the command to chflags nohidden instead.


Hide with a Period

Files or folder names that start with a period (“.”) are automatically hidden in Finder. You can use Terminal to add a period to the beginning of any file or folder’s name, hiding the file from casual view.

1. Open Terminal.

2. Navigate to the folder containing the file you want to hide in Terminal using the cd command.

3. Use the mv command to “move” the file you want to hide from its current name to one starting with a period, like so:

mv myfile .myfile

It doesn’t look like much, but this will immediately hide the file.

To reverse this process, just invert the command:

mv .folder folder

Set the Visibility Attribute to Invisible

If you have Xcode or Apple Developer Tools installed, you can also use the visibility attribute.

1. Open Terminal.

2. Type the following command but don’t press Enter yet:

setfile -a V

3. Drag the file or folder into the Terminal window.

4. Press Enter to execute the command and hide the file.

To undo the command, change the uppercase V to a lowercase v:

setfile -a v file.txt

Revealing Hidden Files in Finder

Locking a door isn’t much good if you cannot also unlock it. There are two main ways to do it, and both will reveal all hidden files, regardless of the method used to hide them.

Both have exactly the same effect, and the second one is typically easier to remember and execute on the fly.

Of course, advanced users will know you can always see hidden files and folders in Terminal with ls -l. You can also employ Finder’s “Go to Folder” command to navigate directly into a hidden folder, provided you know the exact path.

With Terminal

1. Run the command below in Terminal to reveal all hidden files.

defaults write AppleShowAllFiles TRUE ;killall Finder

Finder will restart after you run this command, so make sure you’re not in the middle of emptying the trash or copying files.

When you’re done, re-hide the files by changing the TRUE in the previous command to FALSE, like so:

defaults write AppleShowAllFiles FALSE ;killall Finder

With Finder

1. Open a Finder window and press Command + Shift + Period. This will reveal all hidden files.

2. Hide files again by pressing the same key command: Command + Shift + Period.

Hiding in System Folders

You can also hide files by putting them in system folders. This is the kind of trick you might use to hide confidential materials from a snooping user.

By default, the Library folder is hidden on macOS. This makes it a useful place to stow files, and they’ll be easily accessible.

1. Click on the “Go” menu in Finder.


2. Hold down the Option key to reveal the “Library” menu option.


3. Click on “Library” to navigate to the folder.


4. Create a new folder within the Library folder and name it whatever you’d like.


5. Place your sensitive files inside that directory.

For extra security, you can layer your hidden directory inside multiple cryptically-named folders. Be careful hiding it inside folders actively used by applications, however. Dropping random files into “Library/Application Support” may have unexpected consequences.

These techniques will only hide files from the most novice of computer users. If you’re sick of a friend or family member casually digging around in your stuff, this kind of protection is probably sufficient. You can also take it a step further by password protecting folders.

But be aware that these techniques to hide files, folder, and desktop icons on a Mac offer you zero protection against a serious attempt by a trained professional or even knowledgeable amateur. Don’t forget that you can also encrypt files individually or encrypt your entire disk image. Also, take a look at our guide on how to enable the root user on Mac.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox