How to show hidden files in the Macintosh Finder


Article ID: 181141


Updated On:


Management Platform (Formerly known as Notification Server)




How can I show and/or hide hidden folders and files in the Macintosh Finder window?


Command Line Method:

To show hidden files in finder in Mac OS X 10.4:

defaults write AppleShowAllFiles -bool true

To hide hidden files in finder in Mac OS X 10.4:

defaults write AppleShowAllFiles -bool false

AppleScript Method:

(Quoted from:

Based on the excellent work of posters above, here's my version, which, to my mind improves the user experience in the following ways:

  1. Finder does not quit unless user hits OK first. This way the script can be attached to a macro key stroke or some such thing without becoming annoying on a typo.
  2. It does not ask the user to "think twice" about what state of visibility they want. It reads the current state, and assumes that the person wants to toggle the state. Therefore, the options are limited to Cancel and OK. No obtrusive need to rethink the action you already launched.

Here's my version:

set onOff to do shell script "defaults read AppleShowAllFiles"
if onOff = "NO" or onOff = "OFF" then
  set newState to "show"
  set OnOffCommand to "defaults write AppleShowAllFiles ON"
  set newState to "hide"
  set OnOffCommand to "defaults write AppleShowAllFiles OFF"
end if

display dialog "Are you sure you want to " & newState & " hidden files? (This will restart the Finder)" buttons {"Cancel", "OK"} default button 2
copy the result as list to {BUTTONPRESSED.EN_US}
if the buttonPressed is "OK" then
tell application "Finder" to quit
do shell script OnOffCommand
delay 1
tell application "Finder" to launch
end try
end if

Overview of Mac OS Hidden Files: 

(Quoted from:

Reasons for invisibility

In Mac OS X, there are three different ways a file or directory can be made invisible in the finder: it can have the "invisible" attribute set (as in older Mac OS systems), its name can start with "." (as in other unix systems), or its name can be listed in the /.hidden file. Many of the files and directories listed above are actually invisible for multiple reasons (e.g. /bin is listed in /.hidden, as well as having its invisible attribute set).

Note that OS X only respects the .hidden file on its boot volume, so if you boot from another disk, several normally-hidden files will suddenly be visible. Also, since Mac OS 9 (and older versions) only recognize the invisible flag, even more of these files (mainly /.vol, /mach, /mach.sym, and sometimes .DS_Store) will be visible when you boot into Mac OS 9.