How to Show Hidden Files and Folders in macOS

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

Filing documents
erhui1979/Getty Images

By default, macOS hides critical system files and folders. These are hidden for good reason. If hidden files were visible all the time, the chances are higher that a user would accidentally delete or alter them, which could create catastrophic system-wide problems.

The instructions on this page apply to Mac computers only. If you are on a PC, see how to show or hide hidden files and folders in Windows.

How to Show Hidden Files in macOS

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 the terminal command line prompt:

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

If you're using 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 will now show up.

Most of the time, you will 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 will 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 will 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.

    You can also access Terminal by opening a Finder window and navigating to Applications > Utilities > Terminal.

  2. Enter the following command into the 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, these commands now return the files to a hidden state, and the Finder is restarted 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 simpler.