How to view invisible files
Written by Brent Sheets
Aug 16
The Mac operating system has numerous invisible files and folders. They are hidden to protect the user from mistakenly moving or deleting critical resources that might wreak havoc on the system or the applications that depend on them. Never alter an invisible Mac OS X file unless you know exactly what you’re doing.
The majority of Mac users probably rarely need to fiddle around with invisible files but there are occasions when some of us do. Here are two simple methods that don’t require Terminal dexterity or third-party software.
The Finder
Press Command+F or launch the Finder and select to reveal a new set of pop-up menu titles. Select to open a dialog sheet listing search attributes and select and click . You should now be able to select either visible or invisible as a search criterion.
AppleScript
Here’s an even simpler method and the one that I use. I didn’t write this AppleScript but copied it from some kind soul years ago that had posted it to an online forum. I’m afraid I’ve forgotten who and where I found it or I’d give proper credit, as this script has always worked fine for me.
Copy the AppleScript below and in the Finder menu, select . Paste in the AppleScript code and save with a name you’ll remember. I call mine “Toggle Hidden Files.”
set onOff to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if onOff = "NO" or onOff = "OFF" then
set newState to "show"
set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
else
set newState to "hide"
set OnOffCommand to "defaults write com.apple.finder 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 result as list to {buttonPressed}
if buttonPressed is "OK" then
try
tell application "Finder" to quit
do shell script OnOffCommand
delay 1
tell application "Finder" to launch
end try
end if
Running the script will restart the Finder to show the invisible resources. Run the script again to toggle back to hidden.