How to Show Hidden Files and Folders on Mac

Critical system files may need to be revealed to fix virus damage

What to Know

  • At the terminal command line prompt, enter defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder.
  • By default, macOS hides critical system files and folders to prevent accidental deletion or alteration.

This article covers how to show those hidden files as well as how to hide them again.

Information in this article applies to Macs running macOS Catalina (10.15) through OS X Lion (10.7).

How to Show Hidden Files in macOS

To show hidden files on a Mac, use the Terminal application.

Most hidden files are operating system and configuration files. These should not be deleted or modified unless you are absolutely certain what they do.

  1. Open the Terminal app. You can do this by opening Spotlight and entering the word "terminal" in the search field. You can also access Terminal by opening a Finder window and navigating to Applications > Utilities > Terminal.

  2. Enter the following command into the terminal command line prompt:

    defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

    If you use OS X 10.8 or earlier, enter this command instead:

    defaults write com.apple.finder AppleShowAllFiles TRUE ; killall Finder

The command lines accomplish two goals. The first part changes the file setting to show hidden files. The second part restarts the Finder so the files show up.

Most of the time, you want to keep these hidden files and folders out of view, but there are circumstances where you may want to see them. For example, malware and viruses can cause problems by altering system files or renaming important folders. In such cases, you need to manually change those files back, and you can't do that if they are invisible.

Keep in mind there are lots of hidden files and folders. If you show hidden files and browse through your files in a Finder window, the file list landscape look quite different.

How to Hide Files in macOS

When you're finished with the hidden files and folders, it is a good idea to return those files to their hidden state.

  1. Open the Terminal app. You can do this by opening Spotlight and entering the word "terminal" in the search field or by opening a Finder window and navigating to Applications > Utilities > Terminal.

  2. Enter the following command into the terminal command line prompt:

    defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder

    If you're using OS X 10.8 or earlier, enter this command instead:

    defaults write com.apple.finder AppleShowAllFiles FALSE ; killall Finder

Reversing the process of revealing hidden files, returns the files to a hidden state, and the Finder restarts to reflect the change.

A Word About the Terminal App

Using Terminal is like peeking behind the windows and menus of the graphical user interface you're accustomed to. When you open an application, format a USB flash drive, or search your computer using Spotlight, you are essentially executing Terminal commands; the difference is that the commands have been automated and given a graphical presentation to make their operation more user-friendly.