How to Show and Hide Hidden Files on Mac OS X

Open OS X hidden files and folders with a simple Terminal command.
Image Credit: Image courtesy of Apple.

If there are hidden files on your Mac computer that you need to access, you can make them visible at any time using a single command in Terminal. This quick, straightforward bit of code instructs Finder to display all files and folders, including those that were meant to be hidden from view. In OS X Yosemite, the command takes effect immediately. In earlier versions, like OS X Mavericks, you may need to relaunch Finder before the hidden files become visible.

Step 1

Launch Terminal.
Image Credit: Image courtesy of Apple.

Close all the Finder windows. Launch Terminal by pressing "Command-Space" to open Spotlight. Type "terminal" in the Search field and press "Return."

Step 2

Type "defaults write com.apple.finder AppleShowAllFiles YES."
Image Credit: Image courtesy of Apple.

Type "defaults write com.apple.finder AppleShowAllFiles YES" in Terminal and press "Return." This command directs Finder to show all files, whether they are hidden or not.

Step 3

Hidden files and folders are now visible in Finder.
Image Credit: Image courtesy of Apple.

Launch a new Finder window by clicking the "Finder" icon in the Dock. If you are using OS X Mavericks or earlier, you may have to manually relaunch Finder before you can see hidden files. To do this, hold the "Alt" key while right-clicking the Finder icon in the Dock and select "Relaunch." Hidden files and folders are grayed out; however, they are now visible and accessible.

Step 4

Use "NO" in Terminal to hide files that were meant to be hidden.
Image Credit: Image courtesy of Apple.

Hide the hidden files again by using the same line of code with "NO" at the end, instead of "YES." Type "defaults write com.apple.finder AppleShowAllFiles NO" and press "Return."

Step 5

Hidden files are no longer visible in Finder.
Image Credit: Image courtesy of Apple.

Open a new Finder window to verify that the hidden files and folders are no longer visible. If you still see them using OS X Mavericks or earlier, relaunch Finder by Alt-right-clicking the Finder icon in the Dock and selecting "Relaunch."

Warning

Never modify, move or delete hidden files or folders unless you are certain of the consequences. Altering these files in any way can cause apps or your computer to malfunction. Always perform a full backup of your Mac before altering any system files.

references