How to Hide Files, Folders and Desktop Icons on Mac

Hide Files Folders Icons Mac Featured2

Do you often need to hide files on your Mac? Perhaps you 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 isn’t uitable for the public. Whatever the reason, you are probably looking for a way to quickly hide files, folders and desktop icons on your Mac. This tutorial shows you how to hide files, folders and icons on your Mac desktop and in Finder.

Tip: read our full guide on how to customize your Mac desktop for more ways to create a clean and unique look.

How to Hide Desktop Icons Using Terminal

  1. Open the Terminal app from the Launchpad.
  1. Type in the following command and press Enter to hide everything on your desktop. Your desktop should be blank, without even a single icon on it.
defaults write com.apple.finder CreateDesktop false
killall Finder

How to Unhide Icons on the Desktop Using Terminal

To unhide the icons on your desktop with Terminal, launch Terminal, type in the following command and press Enter.

defaults write com.apple.finder CreateDesktop true
killall Finder

All your files and folders will now reappear on the desktop.

Also read: How to Open Any Folder from the Mac Terminal

How to Use 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 “Settings … “
Finder Menu Settings 1
  1. When the panel opens, make sure you are in the “General” tab.
Finder Settings Menu
  1. Under the “Show these items on the desktop” section, uncheck all of them so that they will no longer be a part of your desktop.
  1. As soon as the items are unchecked, they will be removed from your desktop, helping you keep your desktop uncluttered.
Ventura Desktop Clean

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.

Also read: 4 Ways to Create a New Blank Text File in Any Folder on Your Mac

How to Hide Files With System Commands

macOS offers a couple of 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.

How to Set the Hidden Flag in Terminal

  1. Open Terminal.
  1. Type the following commands, but don’t press the Enter key just yet:
chflags hidden
  1. Drag the file or folder you want to hide into the Terminal window.
File Drag Terminal
  1. Once the path appears in the Terminal window, press Enter to set the hidden flag.
  1. Remove the hidden flag with the same process, but change the command to chflags nohidden.
Terminal Unhide File Drag

How to Hide Files 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.
  1. Navigate to the folder containing the file you want to hide in Terminal using the cd command.
  1. Use the mv command to “move” the file you want to hide from its current name to one starting with a period:
mv myfile .myfile
  1. All your files and folders will now reappear on the desktop.
  2. To reverse this process, just invert the command:
mv .folder folder

Also read: 5 Ways to Reveal a File Path on Mac

How to 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.
  1. Type the following command but don’t press Enter yet:
setfile -a V
  1. Drag the file or folder into the Terminal window.
  1. Press Enter to execute the command and hide the file.
  1. To undo the command, change the uppercase V to a lowercase v:
setfile -a v file.txt

How to Reveal Hidden Files in Finder

Locking a door doesn’t do 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 the same effect, and the second 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.

How to Reveal Hidden Files With Terminal

  1. Run the command below in Terminal to reveal all hidden files.
defaults write com.apple.finder AppleShowAllFiles TRUE ;killall Finder
  1. Finder will restart after you run this command, so make sure you’re not in the middle of emptying the trash or copying files.
  2. When you’re done, re-hide the files by changing the TRUE in the previous command to FALSE, like so:
defaults write com.apple.finder AppleShowAllFiles FALSE ;killall Finder

How to Reveal Hidden Files with Finder

  1. Open a Finder window and press Command + Shift + Period to reveal all hidden files.
  1. Hide files again by pressing the same key command: Command + Shift + Period.

How to Hide Files in System Folders

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

By default, the Library folder is hidden on macOS, making it a useful place to stow files where they’re easily accessible.

  1. Click on the “Go” menu in Finder.
Finder Go Menu Mac
  1. Hold down the Option key to reveal the “Library” menu option.
Finder Go Menu Library
  1. Click on “Library” to navigate to the folder.
Finder Go Library Click
  1. Create a new folder within the Library folder and name it whatever you’d like.
Library Folder Rename Mac
  1. Place your sensitive files inside that directory.

Also read: How to Delete Files from Your Mac that Won’t Delete

How to Hide Files Using FileVault

The security feature on your Mac called FileVault can encrypt your entire drive to conceal sensitive files. FileVault creates a folder that is invisible and requires administrator login credentials to become accessible.

  1. Launch the System Settings app on your Mac.
Mac System Settings
  1. Select “Privacy and Security” from the sidebar.
Mac Privacy Toggle Settings
  1. Locate the FileVault menu and select the button labeled “Turn On … ” You may be asked to enter your login credentials.
Filevault Turn On
  1. Choose a recovery method. You can create a recovery key and write it down or use iCloud to unlock your disk.
  2. Restart your Mac.

Also read: 8 Ways to Fix Unresponsive Apps and System Freezes on Mac

Frequently Asked Questions

Do hide/unhide workflows work the same on all Macs?

Yes, the procedures and Terminal commands listed above will work on most modern versions of macOS, including Mac desktops and notebook computers. These methods have even been tested on the latest build of macOS Ventura. If you would like to take guarding your files a step further, you can learn about password-protecting folders.

Can I recover files that I accidentally deleted using the Trash?

You can by performing a two-finger click on a trashed file, then selecting “Put Pack” from the drop-down menu. If you would like to recover files that have already been deleted, you can use an app like Disk Drill to perform a deep system scan.

Is Xcode required to configure visibility attributes?

Yes. You can visit the App Store app, then download and install the latest version of Xcode for free.

Image credit: Jeremy Bezanger via Unsplash All screenshots taken by Brahm Shank

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Brahm Shank

Self-proclaimed coffee connoisseur and tech enthusiast Brahm Shank is captivated by the impact of consumer tech: “It’s profoundly moving when people discover that the phone in their pocket or the tiny computer on their wrist has the power to enrich their lives in ways they never imagined.” Apple, Inc. and its unique position at the intersection of technology and the creative arts, resonates deeply with Brahm and his passion for helping people unleash their potential using technology. Over the years, Brahm has held various podcasts - including famed technologist David Pogue of The New York Times on topics such as Big Tech and digital wellness.